home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / libs / shadowlib.lha / shadow / Docs / ShadowLibraryFuncs.doc < prev    next >
Text File  |  1992-11-13  |  137KB  |  4,374 lines

  1.                        Shadow.library  Documentation
  2.                             Library Version 5.0
  3.  
  4.                               By David Navas
  5.                          Updated:  13 Nov 1992
  6.  
  7.                       Copyright © 1992 by David Navas
  8.                             All Rights Reserved
  9.  
  10. NAME
  11.       AddAttributes -- Create the attribute table for a class.
  12.  
  13. SYNOPSIS
  14.       result = AddAttributes( class, tags, num, offset )
  15.         d0                      a0    a1   d0     d1
  16.  
  17. FUNCTION
  18.       This function creates the array of Attribute structures that are
  19.       described both by the tags and by the superclass of the passed
  20.       class.
  21.  
  22.       This is a low-level function which is used by the provided
  23.       Metas.  You should not have to call this function yourself,
  24.       however you can if for some reason you feel compelled to do
  25.       so.
  26.  
  27.       Note that the array of Attributes, as stored in the class'
  28.       AttributeTable, includes all of the attributes, both as described
  29.       in the tags, AND as described in the superclass.  If you're
  30.       looking for an attribute description, you don't need to look at
  31.       any superclass to find it.
  32.  
  33.       It is unfortunate that, unlike METHODs, attributes defined in the
  34.       superclass have to copied to all subclasses.  In reality, only
  35.       the WATCHED attributes NEED to be copied, however this
  36.       involves an increased level of complexity which has yet to be
  37.       implemented, and so it remains -- 16bytes per attribute.... sigh.
  38.  
  39.       There are some benefits, however.  Multiple inheritence of
  40.       attributes is easy.  It's unimplemented, but it's a hop-skip-jump
  41.       away....
  42.  
  43.       After forming the AttibuteTable, the attributes are qsort'ed by the
  44.       attribute name, for fast attribute lookup.  Note that this is a
  45.       sorting by the System String's address, not by the string's value.
  46.       For more information about system Strings, see the UseString()
  47.       function.
  48.  
  49.  
  50. INPUTS
  51.       META                 class; - the new class for which to build an
  52.                                      AttributeTable.
  53.                                     Function returns NULL if NULL class is
  54.                                      passed.
  55.       ATTRIBUTE_TAG        tags[]; - the (optional) new atributes to
  56.                                      include.
  57.       long                   num; - the number of additional attributes
  58.                                      from the class' superClass -- as
  59.                                      returned by PrepareAttrTags().
  60.       ULONG               offset; - the offset at which the next attribute
  61.                                      will reside.  This is usually the
  62.                                      size of the class' superClass.
  63.  
  64. OUTPUTS
  65.       long                result; - result code (should be a BOOL, oh well.)
  66.  
  67.       Specifies whether the AttributeTable was successfully built.  NULL
  68.       indicates an error.
  69.  
  70. RESULT
  71.       The specified class' AttributeTable is initialized.
  72.  
  73. BUGS
  74.       none known.
  75.  
  76. NOTES
  77.       Attributes are guaranteed to be arranged according to the order in
  78.       which they are specified in the tags[].  This allows you to build
  79.       a fixed structure over several attributes, or even over the whole
  80.       object definition.  [Internally this is done for all of the classes,
  81.       with the exception of DIRECTOR_CLASS.]
  82.       EG:
  83.          The following:
  84.             ATTR_1      struct MyAttr1
  85.             ATTR_2      struct MyAttr2
  86.             ATTR_3      struct MyAttr3
  87.  
  88.          Is basically the same as:
  89.             ATTR_1      struct {
  90.                            struct MyAttr1
  91.                            struct MyAttr2
  92.                            struct MyAttr3
  93.                         };
  94.  
  95. SEE ALSO
  96.       PrepareAttrTags()
  97.       CopyDefaultAttributes()
  98.       FreeAttributes()
  99.       FindAttribute()
  100.       FindAttrDefn()
  101.       UseString()
  102.  
  103. NAME
  104.       AddAutoResource -- Adds an automatically freed resource to a process.
  105.  
  106. SYNOPSIS
  107.       result = AddAutoResource( task, resource, key)
  108.         d0                       a0      d0     a1
  109.  
  110. FUNCTION
  111.       This function adds the specified resource to the optionally
  112.       specified task (defaults to current task) using the specified
  113.       key.
  114.  
  115.       These resources are kept on the PROCESS_CLASS' ATTR_RESOURCETREE,
  116.       and are automatically freed (via a METH_REMOVE, and a
  117.       DropObject()) whenever:
  118.          a) The process receives a METH_REMOVE
  119.          b) The process receives a METH_DESTROY
  120.          c) The process receives a METH_PROC_DISASSOCIATE
  121.          d) A program inside of RemoveCurrentProgram() receives a ^C
  122.          e) The default thread-start function inside of SHADOW (after
  123.             returning from the METH_PROC_HANDLER method) receives a ^C.
  124.  
  125.       It is important to note that the resource is TRANSFERRED to
  126.       (swallowed by) the ATTR_RESOURCETREE.  So you no longer own an
  127.       object pointer to the resource you passed to AddAutoResource().
  128.  
  129.       If this is a problem you can do:
  130.          AddAutoResource(NULL, UseObject(resource), MYNAME)
  131.          .
  132.          .
  133.          <code referencing resource>
  134.          .
  135.          .
  136.          DropObject(resource)
  137.  
  138.          <continue processing, no longer have pointer to resource>
  139.          .
  140.          .
  141.  
  142. INPUTS
  143.       OBJECT                 task; - The optional task object that performs
  144.                                       the auto-tracking.  If not specified,
  145.                                       assumes current taskObject.
  146.       OBJECT             resource; - The object to auto-track.
  147.       char                   *key; - The name of the resource.  Resources
  148.                                       without names (key == NULL) are stored
  149.                                       by their addresses.  Name addresses of
  150.                                       0-255 are reserved for priority freeing.
  151.                                       Resources are freed in INCREASING
  152.                                       key order.  Obviously, you can't
  153.                                       use AddAutoResource() to add a
  154.                                       resource at priority zero, as then the
  155.                                       resource would be added at the address
  156.                                       of the resource (NULL == 0).
  157.  
  158.  
  159. OUTPUTS
  160.       BOOL                result; - result code
  161.  
  162.       Specifies whether the resource was added correctly.  If it was not,
  163.       the resource is sent a METH_REMOVE, is dropped, and a FALSE value
  164.       is returned to indicate an error.
  165.  
  166.       If the resource was NULL, then this function returns FALSE
  167.  
  168.       Otherwise returns TRUE
  169.  
  170. RESULT
  171.       The resource is now auto-tracked by the indicated process.
  172.  
  173. BUGS
  174.       none known.
  175.  
  176. NOTES
  177.  
  178. SEE ALSO
  179.       RemoveAutoResource()
  180.       DropObject()
  181.       UseObject()
  182.  
  183. NAME
  184.       AddClassWatcher -- Adds a watcher to the given class.
  185.  
  186. SYNOPSIS
  187.       result = AddClassWatcher( watchName, director, pri, name, class )
  188.         d0                          a0        a1      d2   d0     d1
  189.  
  190. FUNCTION
  191.       This function will add the director to the class' attribute's
  192.       watching SList at the given priority with the given name.
  193.  
  194.       This is a low-level function.  You should use the provided
  195.       DIRECTOR_CLASS methods instead and ask specifically for a
  196.       class watcher.  Example is in browser.c -- GlobalDirector....
  197.       Or see the inluded ShadowLibraryMethods.doc for more details
  198.  
  199.  
  200. INPUTS
  201.       char             *watchName; - the attribute name to watch
  202.       OBJECT             director; - the director to add to the attribute
  203.                                       watching SList.
  204.       long                    pri; - the priority to add the watcher as.
  205.       char                  *name; - the name of the watcher.
  206.       META                  class; - the class to add the watcher to.
  207.  
  208.  
  209. OUTPUTS
  210.       BOOL result; - result code
  211.  
  212.       The result code is a boolean indicating the success or failure of
  213.       the function call.  A zero value indicates that an error occured.
  214.  
  215.  
  216. RESULT
  217.       The director is added to the class' attribute's watch list.
  218.  
  219. BUGS
  220.       none known.
  221.  
  222. NOTES
  223.  
  224. SEE ALSO
  225.       AddWatcherNode()
  226.       RemoveWatcherNode()
  227.       RemoveClassWatcher()
  228.  
  229. NAME
  230.       AddMethods -- initializes a class' method table
  231.  
  232. SYNOPSIS
  233.       result = AddMethods( class, tags )
  234.         d0                   a0    a1
  235.  
  236. FUNCTION
  237.       This function creates the array of MethodHandler structures that are
  238.       described both by the tags.
  239.  
  240.       This is a low-level function which is used by the provided
  241.       Metas.  You should not have to call this function yourself,
  242.       however you can if for some reason you feel compelled to do
  243.       so.
  244.  
  245.       Note that the array of MethodHandlers, as stored in the class'
  246.       MethodTable, includes only those methods described in the tags
  247.       field.  Unlike attributes, the superclass' methods are NOT
  248.       copied down to the newly defined class.
  249.  
  250.       While creating the MethodHandlers, the passed procObject and
  251.       defnObject are UseObject()'d, ensuring that the destination process
  252.       and the defining process hang around until the class referencing the
  253.       methods goes away.
  254.  
  255.       After forming the MethodTable, the methods are qsort'ed by the
  256.       method name, for fast method lookup.  Note that this is a
  257.       sorting by the System String's address, not by the string's value.
  258.  
  259.  
  260. INPUTS
  261.       META              class; - required class to add the methods to.
  262.       METHOD_TAG       tags[]; - the (optional and NULL-terminated) array
  263.                                  of MethodTag elements.
  264.  
  265. OUTPUTS
  266.       int result; - result code
  267.  
  268.       The result code is an integer indicating the success or failure of
  269.       the function call.  A zero value indicates that an error occured.
  270.  
  271.  
  272. RESULT
  273.       The class' verbs field is initialized.
  274.  
  275. BUGS
  276.       none known.
  277.  
  278. NOTES
  279.  
  280. SEE ALSO
  281.       DSM()                            DoShadow() [ShadowLibFuncs.doc]
  282.       InvalidateCache()
  283.       SetMethodArgs()
  284.       DestroyMethodTable()
  285.       FindMethodHandle()
  286.       BlockMethod()
  287.       RemoveAllPatches()
  288.       SetupMethodTags()
  289.  
  290. NAME
  291.       AddSListNode -- Adds a node to a prioritized singly linked list.
  292.  
  293. SYNOPSIS
  294.       result = AddSListNode( list, object, pri, name )
  295.         d0                    a0     a1     d0   d1
  296.  
  297. FUNCTION
  298.       This function adds an object into a singly linked list with the
  299.       given name at the given priority (list is ordered by
  300.       priority).
  301.  
  302.  
  303. INPUTS
  304.       SList               *list; - a pointer to the list to which to add
  305.                                     the object.
  306.       OBJECT             object; - the object to add.
  307.       long                  pri; - the priority
  308.       char                *name; - the name to add it as.
  309.  
  310.  
  311. OUTPUTS
  312.       BOOL result; - result code
  313.  
  314.       The result code is an integer indicating the success or failure of
  315.       the function call.  A zero value indicates that an error occured.
  316.  
  317.       Lists of equal priorities are treated as LIFOs.
  318.  
  319.  
  320. RESULT
  321.       The list has one more node on it -- the passed object.
  322.  
  323. BUGS
  324.       none known.
  325.  
  326. NOTES
  327.  
  328. SEE ALSO
  329.       FindNodePriInSList()                AddWatchedSListNode()
  330.       RemoveSListNode()                   RemoveWatchedSListNode()
  331.  
  332. NAME
  333.       AddTreeNode    -- adds an object into  binary tree.
  334.  
  335. SYNOPSIS
  336.       result = AddTreeNode( bt, object, key)
  337.         d0                  a0    a1    d0
  338.  
  339. FUNCTION
  340.       This function will add the object into the binary tree sorted on
  341.       the key provided.
  342.  
  343.       The object is Used() by the UseObject() call when successfully
  344.       placed in the binary tree.
  345.  
  346.       Any number of objects may exist in any number of binary trees.
  347.       There is no restriction on how many trees an object can be
  348.       placed, nor in how many times an object can reside in a binary
  349.       tree (as there is with Exec lists).
  350.  
  351.       In addition, unlike many AVLTree implementation, objects
  352.       inserted with the same key are handled correctly.
  353.  
  354.  
  355. INPUTS
  356.       AVLTREE               *bt; - a pointer to the root of the binary tree.
  357.       OBJECT             object; - the object to add into the tree.
  358.       ULONG                 key; - the key value to insert on.
  359.  
  360. OUTPUTS
  361.       BOOL result; - result code
  362.  
  363.       zero on failure.  (Couldn't allocate binary node)
  364.  
  365.  
  366. RESULT
  367.       Object is added into binary tree.
  368.  
  369. BUGS
  370.       NOne known.
  371.  
  372. NOTES
  373.       Uses AVL trees.  Do not depend on order of insertion
  374.       on duplicate keys.  (Duplicate keys do work, though.)
  375.  
  376.       Remember that the keys are sorted unsigned, not signed.
  377.  
  378. SEE ALSO
  379.       UseObject()
  380.  
  381.       AddTreeStringNode()        AddWatchedTreeNode()
  382.       FindTreeNode()             AddWatchedTreeStringNode()
  383.       FreeTreeAllNodes()         RemoveWatchedTreeNode()
  384.       RecurseTree()              RemoveWatchedTreeStringNode()
  385.       RemoveTreeNode()
  386.       RemoveTreeStringNode()
  387.  
  388. NAME
  389.       AddTreeStringNode -- add an object to an AVLTREE keyed on a string.
  390.  
  391. SYNOPSIS
  392.       result = AddTreeStringNode( bt, object, name )
  393.         d0                        a0    a1     d1
  394.  
  395. FUNCTION
  396.       This function will add the object into the binary tree sorted on
  397.       the name provided.
  398.  
  399.       The object is Used by the UseObject() call when successfully placed
  400.       in the binary tree.
  401.  
  402.       The name uses the UseString and DropString conventions
  403.       for system strings.  The address of that string then
  404.       determines the order the binary tree is sorted in.  It
  405.       is NOT sorted by the string itself, sorry.
  406.  
  407.  
  408. INPUTS
  409.       AVLTREE               *bt; - a pointer to the root of the binary tree.
  410.       OBJECT             object; - the object to add into the tree.
  411.       char                *name; - the name to insert on.
  412.  
  413. OUTPUTS
  414.       BOOL result; - result code
  415.  
  416.       zero on failure.  (Couldn't allocate binary node, or system string)
  417.  
  418.  
  419. RESULT
  420.       The object is added into the binary tree sorted on the address of
  421.       the system string that is uniquely created on the passed name.
  422.  
  423. BUGS
  424.       none known.
  425.  
  426. NOTES
  427.       Yes, the third parameter is d1, not d0
  428.  
  429.       No, the binary tree is not sorted on the actual string, but on the
  430.       address of the associated system string.
  431.  
  432. SEE ALSO
  433.       UseObject()
  434.       DropString()/UseString()
  435.  
  436.       AddTreeNode()              AddWatchedTreeNode()
  437.       FindTreeNode()             AddWatchedTreeStringNode()
  438.       FreeTreeAllNodes()         RemoveWatchedTreeNode()
  439.       RecurseTree()              RemoveWatchedTreeStringNode()
  440.       RemoveTreeNode()
  441.       RemoveTreeStringNode()
  442.  
  443. NAME
  444.       AddWatchedSListNode -- Adds a node to a watched, prioritized singly-
  445.                               linked list.
  446.  
  447. SYNOPSIS
  448.       result = AddWatchedSListNode( list, object, pri, name )
  449.         d0                           a0     a1     d0   d1
  450.  
  451. FUNCTION
  452.       This function adds an object into a watched, singly-linked list with
  453.       the given name at the given priority (list is ordered by priority).
  454.  
  455.       If any parties are interested, WatcherDispatch is called with
  456.       W_INSERT_NODE for the flag paramter.
  457.  
  458.  
  459. INPUTS
  460.       W_SLIST              list; - a pointer to the list to which to add
  461.                                     the object.
  462.       OBJECT             object; - the object to add.
  463.       long                  pri; - the priority
  464.       char                *name; - the name to add it as.
  465.  
  466.  
  467. OUTPUTS
  468.       BOOL result; - result code
  469.  
  470.       The result code is an integer indicating the success or failure of
  471.       the function call.  A zero value indicates that an error occured.
  472.  
  473.  
  474. RESULT
  475.       The list has one more node on it -- the passed object.
  476.  
  477. BUGS
  478.       none known.
  479.  
  480. NOTES
  481.  
  482. SEE ALSO
  483.       AddSListNode()
  484.       FindNodePriInSList()
  485.       RemoveSListNode()                   RemoveWatchedSListNode()
  486.  
  487. NAME
  488.       AddWatchedTreeNode    -- adds an object into watched binary tree
  489.  
  490. SYNOPSIS
  491.       result = AddWatchedTreeNode( bt, object, key)
  492.         d0                         a0    a1    d0
  493.  
  494. FUNCTION
  495.       This function will add the object into the watched binary tree
  496.       sorted on the key provided.
  497.  
  498.       The object is Used() by the UseObject() call when successfully
  499.       placed in the binary tree.
  500.  
  501.       Any number of objects may exist in any number of binary trees.
  502.       There is no restriction on how many trees an object can be
  503.       placed (as there is on Exec lists).
  504.  
  505.       If any parties are interested, WatcherDispatch is called with
  506.       W_INSERT_NODE for the flag parameter.
  507.  
  508.  
  509. INPUTS
  510.       W_AVLTREE              bt; - a pointer to the root of the watched
  511.                                     binary tree.
  512.       OBJECT             object; - the object to add into the tree.
  513.       ULONG                 key; - the key value to insert on.
  514.  
  515. OUTPUTS
  516.       BOOL result; - result code
  517.  
  518.       zero on failure.  (Couldn't allocate binary node)
  519.  
  520.  
  521. RESULT
  522.       Object is added into binary tree.
  523.  
  524. BUGS
  525.       none known.
  526.  
  527. NOTES
  528.       Uses AVL trees.  Do not depend on order of insertion
  529.       on duplicate keys.  (Duplicate keys do work, though.)
  530.  
  531.       Remember that the keys are sorted unsigned, not signed.
  532.  
  533. SEE ALSO
  534.       UseObject()
  535.  
  536.       AddTreeNode()
  537.       AddTreeStringNode()            AddWatchedTreeStringNode()
  538.       FindTreeNode()
  539.       FreeTreeAllNodes()
  540.       RecurseTree()
  541.       RemoveTreeNode()               RemoveWatchedTreeNode()
  542.       RemoveTreeStringNode()         RemoveWatchedTreeStringNode()
  543.  
  544. NAME
  545.       AddWatchedTreeStringNode -- add an object to a watched AVLTREE,
  546.                                       keyed on a string.
  547.  
  548. SYNOPSIS
  549.       result = AddWatchedTreeStringNode( bt, object, name )
  550.         d0                               a0    a1     d0
  551.  
  552. FUNCTION
  553.       This function will add the object into the watched binary tree
  554.       sorted on the name provided.
  555.  
  556.       The object is Used by the UseObject() call when successfully placed
  557.       in the binary tree.
  558.  
  559.       The name uses the UseString and DropString conventions
  560.       for system strings.  The address of that string then
  561.       determines the order the binary tree is sorted in.  It
  562.       is NOT sorted by the string itself, sorry.
  563.  
  564.       If any parties are interested, WatcherDispatch is called with
  565.       W_INSERT_NODE for the flag parameter.
  566.  
  567.  
  568. INPUTS
  569.       W_AVLTREE              bt; - a pointer to the root of the watched
  570.                                     binary tree.
  571.       OBJECT             object; - the object to add into the tree.
  572.       char                *name; - the name to insert on.
  573.  
  574. OUTPUTS
  575.       BOOL result; - result code
  576.  
  577.       zero on failure.  (Couldn't allocate binary node, or system string)
  578.  
  579.  
  580. RESULT
  581.       The object is added into the binary tree sorted on the address of
  582.       the system string that is uniquely created on the passed name.
  583.  
  584. BUGS
  585.       none known.
  586.  
  587. NOTES
  588.       No, the binary tree is not sorted on the actual string, but on the
  589.       address of the associated system string.
  590.  
  591. SEE ALSO
  592.       UseObject()
  593.       DropString()/UseString()
  594.  
  595.       AddTreeNode()               AddWatchedTreeNode()
  596.       AddWatchedTreeStringNode()
  597.       FindTreeNode()
  598.       FreeTreeAllNodes()
  599.       RecurseTree()
  600.       RemoveTreeNode()            RemoveWatchedTreeNode()
  601.       RemoveTreeStringNode()      RemoveWatchedTreeStringNode()
  602.  
  603. NAME
  604.       AddWatcherNode -- Adds a watcher to the watched variable
  605.  
  606. SYNOPSIS
  607.       result = AddWatcherNode( wv, node, pri, name )
  608.         d0                     a0   a1    d0   d1
  609.  
  610. FUNCTION
  611.       This function will add a watcher object (sometimes referred to
  612.       as a 'director') into the WatchedVariable wv.
  613.  
  614.       This is a low-level routine.  You should use the provided
  615.       DIRECTOR_CLASS method.  See browser.c for some examples, or the
  616.       included ShadowLibMethods.doc for more details.
  617.  
  618.       If any parties are interested, WatcherDispatch is called with
  619.       W_INSERT_WATCHER for the flag parameter.
  620.  
  621.  
  622. INPUTS
  623.       W_VALUE              wv; - the watched variable to watch
  624.       OBJECT             node; - the director to add to the watch list.
  625.       long                pri; - the priority to add the watcher as.
  626.       char              *name; - the name of the watcher.
  627.  
  628. OUTPUTS
  629.       BOOL              result; - result code
  630.  
  631.       The result code is a boolean indicating the success or failure of
  632.       the function call.  A zero value indicates that an error occured.
  633.  
  634.  
  635. RESULT
  636.       The director is added to the watch list.
  637.  
  638. BUGS
  639.       none known.
  640.  
  641. NOTES
  642.  
  643. SEE ALSO
  644.       RemoveWatcherNode()
  645.       AddClassWatcher()
  646.       RemoveClassWatcher()
  647.  
  648. NAME
  649.       AllocateItem -- Allocates an item from a MemoryList
  650.  
  651. SYNOPSIS
  652.       element = AllocateItem( list )
  653.          d0                    a0
  654.  
  655. FUNCTION
  656.       Allocates an element from the list.
  657.       The element will NOT be zeroed out, and may contain data from the
  658.       last time that element was used.
  659.  
  660.       Elements are allocated 32 at a time via the allocfunc() that was
  661.       passed to the InitTable() function.  AllocateItem() doles out
  662.       these elements one by one, automatically calling allocfunc()
  663.       when necessary (ie: when it needs another 32 elements because it
  664.       has no more free elements).
  665.  
  666.  
  667. INPUTS
  668.       SEMLIST list; - the list to allocate from.
  669.  
  670. OUTPUTS
  671.       void *element; - element that is allocated.
  672.  
  673.       As with any allocation function, this function can return NULL for
  674.       a failure to allocate memory.
  675.  
  676.  
  677. RESULT
  678.       One item is allocated on the Memorylist
  679.  
  680. BUGS
  681.       none known.
  682.  
  683. NOTES
  684.       The memory returned is NOT zeroed.
  685.  
  686. SEE ALSO
  687.       InitTable()
  688.       FreeTable()
  689.       FreeItem()
  690.  
  691. NAME
  692.       BindSuperWatchers -- copies all watchers on the superClass' watched
  693.                             attributes to the subclass.
  694.  
  695. SYNOPSIS
  696.       result = BindSuperWatchers( class )
  697.         d0                          a0
  698.  
  699. FUNCTION
  700.       This function is called internally during METH_INIT of all classes
  701.       and metas.
  702.       A search is done on the immediate superClass' attributes.  Any
  703.       watchers found on the class' attribute list are copied to the
  704.       passed class' attribute.
  705.  
  706.       Thus, if a new class subclassed off of WindowClass was created
  707.       while running browser, the watcher that was watching all of the
  708.       window classes will watch that new window class as well.
  709.  
  710.  
  711. INPUTS
  712.       META class; - the (sub)class to bind the watchers.
  713.  
  714. OUTPUTS
  715.       BOOL result; - the result code.
  716.  
  717.       FALSE indicates failure to copy all the watchers.  Probably ran out
  718.       of memory allocating list nodes.
  719.  
  720. RESULT
  721.       The class' watched variables can now send out notification to the
  722.       old class watchers for any new objects that are created and stored
  723.       there, or for any changes in value made to the watched variable.
  724.  
  725. BUGS
  726.       none known.
  727.  
  728. NOTES
  729.  
  730. SEE ALSO
  731.       BindWatchers()
  732.       AddWatcherNode()
  733.       AddClassWatcher()
  734.       WatcherDispatch()
  735.  
  736. NAME
  737.       BindWatchers -- binds all object's attributes' watched wv_firstClass
  738.                        to the appropriate spot in the object's class.
  739.  
  740. SYNOPSIS
  741.       BindWatchers( object )
  742.                        a0
  743.  
  744. FUNCTION
  745.       This function is called internally during METH_INIT of all objects.
  746.       It sets all watched variables in the object to have their
  747.       wv_firstClass pointer pointing to the class' attributes' SList,
  748.       like it is supposed to.
  749.  
  750.       This allows notification of any changes to the watched variable to
  751.       be sent out on a class basis -- any object of the class will
  752.       attempt to send notification to both the specific object, and
  753.       the associated class.
  754.  
  755.       An example is in browser.c which is notified whenever any object
  756.       is added to the ATTR_GUICHILDREN of any object whose class is
  757.       a descendent of WindowClass.
  758.  
  759.  
  760. INPUTS
  761.       OBJECT object; - the object to bind the watchers.
  762.  
  763. OUTPUTS
  764.  
  765.  
  766. RESULT
  767.       The object's watched variables can now send out notification to the
  768.       class watchers.
  769.  
  770. BUGS
  771.       none known.
  772.  
  773. NOTES
  774.  
  775. SEE ALSO
  776.       BindSuperWatchers()
  777.       AddWatcherNode()
  778.       AddClassWatcher()
  779.       WatcherDispatch()
  780.  
  781. NAME
  782.       BlockMethod -- [un]blocks via a METH_FLAG_PREBLOCK, the method
  783.                      in a given class.
  784.  
  785. SYNOPSIS
  786.       BlockMethod( class, name, pri, block )
  787.                     a0     a1    d0    d1
  788.  
  789. FUNCTION
  790.       This function will search the class for a method of the given name.
  791.       If pri is non-zero, the patched verbs list of the class is searched
  792.       for a method patch of the given name and priority.
  793.  
  794.       This handle is then either PRE_BLOCK'd or un-PRE_BLOCK'd,
  795.       according to the block flag.
  796.  
  797.  
  798. INPUTS
  799.       META         class; - the class where the method is found.
  800.       char         *name; - the name of the method to [un]block.
  801.       WORD           pri; - the priority (or nearest priority) of where
  802.                                  the block should take effect.
  803.                             If pri is non-zero, a patch of that pri must
  804.                                  exist.
  805.       WORD         block; - whether to block (TRUE) or to unblock (FALSE)
  806.  
  807. OUTPUTS
  808.       none
  809.  
  810.  
  811. RESULT
  812.       A method may be [un]blocked.
  813.  
  814. BUGS
  815.       none known.  Not yet tested!  (07 Oct 1992)
  816.  
  817. NOTES
  818.  
  819. SEE ALSO
  820.       DSM()                            DoShadow()
  821.       InvalidateCache()
  822.       SetMethodArgs()
  823.       AddMethods()
  824.       DestroyMethodTable()
  825.       FindMethodHandle()
  826.       RemoveAllPatches()
  827.       SetupMethodTags()
  828.  
  829. NAME
  830.       ChangeWatchedValue -- Changes a watched variable's value.
  831.  
  832. SYNOPSIS
  833.       ChangeWatchedValue( wv, new )
  834.                           a0   d0
  835.  
  836. FUNCTION
  837.  
  838.       Changes the watched variable to the passed new value.
  839.  
  840.       If any parties are interested, WatcherDispatch is called with
  841.       either W_CHANGE_ZERO or W_CHANGE_NON_ZEROin the flag parameter.
  842.  
  843.  
  844. INPUTS
  845.       W_VALUE              wv; - a watched variable to change.
  846.       long                new; - the value to change to.
  847.  
  848. OUTPUTS
  849.  
  850.  
  851. RESULT
  852.       The value is changed, and all parties notified.
  853.  
  854. BUGS
  855.       none known.
  856.  
  857. NOTES
  858.  
  859. SEE ALSO
  860.       WatcherDispatch()
  861.  
  862. NAME
  863.       CopyDefaultAttributes -- Copy the default attrs into the instance
  864.  
  865. SYNOPSIS
  866.       CopyDefaultAttributes( object )
  867.                                a0
  868.  
  869. FUNCTION
  870.       This function will copy the default values, specified in the
  871.       object's class, into the object.  It is executed by both MetaClass
  872.       and MetaCluster, and by both rootClass and rootCluster in the
  873.       METH_CREATE method.
  874.  
  875.       It assumes the object is already filled with ZEROs.
  876.  
  877.  
  878. INPUTS
  879.       OBJECT object; - The object whose attributes should be initialized.
  880.  
  881. OUTPUTS
  882.       none
  883.  
  884.  
  885. RESULT
  886.       The object's attributes are initialized to the attribute default
  887.       values stored in the object's class.
  888.       Object is assumed to have already been initialized to ZEROs.
  889.  
  890. BUGS
  891.       none known.
  892.  
  893. NOTES
  894.       object is a required parameter.
  895.  
  896. SEE ALSO
  897.       PrepareAttrTags()
  898.       AddAttributes()
  899.       FreeAttributes()
  900.       FindAttribute()
  901.       FindAttrDefn()
  902.  
  903. NAME
  904.       CreateMeta -- Creates a self-referencing class description.
  905.  
  906. SYNOPSIS
  907.       meta = CreateMeta( description )
  908.        d0                    a0
  909.  
  910. FUNCTION
  911.       This function creates a Meta.
  912.  
  913.       A Meta is a class whose class is itself.  Metas are useful for
  914.       describing Classes and such.  The current system creates two
  915.       Metas:  MetaClass and MetaCluster.
  916.  
  917.       The description is used to create the Meta using the attributes
  918.       and superClass pointers.  The superClass field, the attribute
  919.       table and the method table are all filled in.  The name is NOT,
  920.       nor is any other information in the description touched.
  921.  
  922.       The passed description's object and class pointers are set up as
  923.       the allocated meta, the method is initialized either to METH_INIT
  924.       (if the passed description's method as NULL) or left as passed
  925.       (if not NULL).
  926.  
  927.       CreateMeta then returns "DSM(INVOKE_FIND_SELECTOR, description)".
  928.  
  929.       This implies several things:
  930.  
  931.          You can create meta structures that need initialization by
  932.          passing the appropriate arguments in the InitMeta structure.
  933.          See the InitMeta structure for more details.
  934.  
  935.          Your METH_INIT methods should, then, -do-the-right-thing- when
  936.          passed its own meta, rather than a proper instance of
  937.          that meta.  The correct method for checking for such an event
  938.          is to compare 'object' with 'object->cob_class' as in:
  939.  
  940.             MyMethod(METHOD_ARGS, MYMETHODARGS)
  941.             {
  942.                if (object == object->cob_class)
  943.                {
  944.                   /*
  945.                    * we were passed a meta, so
  946.                    *  do what we needed to do with that.
  947.                    */
  948.                } else
  949.                {
  950.                   /*
  951.                    * We were passed a proper instance, so do
  952.                    *  what is necessary here.
  953.                    */
  954.                }
  955.             }
  956.          Specifically, you should NOT do a comparison between 'object'
  957.          and 'class'.  Class can change if called as a superclass method.
  958.          The object might still be a meta, just not THAT method's meta....
  959.  
  960.          As always, the following methods should also handle being sent a
  961.          Meta:  METH_DESTROY, METH_REMOVE.
  962.  
  963.          METH_SUB should also handle Metas by filling in the superClass
  964.          pointer and passing the arguments to CreateMeta.
  965.          The following code segment may be useful:
  966.  
  967.             MethodMetaSub(METHOD_ARGS, name, superClass, attrList, verbList)
  968.             {
  969.                if (!superClass)
  970.                   superClass = object;
  971.  
  972.                if (object == object->cob_class)
  973.                {
  974.                   struct InitMeta *im;
  975.  
  976.                   im = (struct InitMeta *)&object;
  977.  
  978.                   im->im_object = im->im_class = NULL;
  979.                   im->im_method = NULL;
  980.                   im->im_super = superClass;
  981.                   return CreateMeta(im);
  982.                }
  983.  
  984.                .
  985.                .
  986.                .
  987.             }
  988.  
  989.          A consequence of using METH_SUB to create new Metas is that
  990.          the initialization parameters are truncated to match the
  991.          METH_SUB parameter description, which might not pass all the
  992.          required parameters into the InitMeta structure sent to
  993.          CreateMeta!  Please remember what you are doing.
  994.  
  995.       The description structure that is passed is a fixed length header
  996.       with a variable length number of additional arguments (which should
  997.       match the initialization routine CreateMeta calls: either the contents
  998.       of description->im_method OR METH_INIT if that is NULL).  As a result,
  999.       this argument list MUST be terminated by a METHOD_END.  Note that
  1000.       all method invocations have a METHOD_END located one argument
  1001.       passed their last defined argument, thus allowing the above code to
  1002.       work properly.
  1003.  
  1004.       Your initialization routine is responsible for setting the Meta's name
  1005.       and adding the meta to ShadowBase->sb_metaTree.  However, it should
  1006.       specifically NOT setup the attribute tables and method tables (like
  1007.       it would in the case of a new class) as CreateMeta has already
  1008.       done that for you.
  1009.  
  1010.       The instances of Metas have, likewise, the same attributes as the Meta
  1011.       (as part of their instance, where the Metas have those attributes in
  1012.       both the INSTANCE and in their attribute description table).
  1013.  
  1014.       Reminder:
  1015.          the METH_REMOVE of the meta must distinguish between the case
  1016.          where the passed object != meta (meaning the object is an
  1017.          instance of Meta, and so should be removed from the
  1018.          ATTR_INSTANCETREE of the object->cob_class) and the case where
  1019.          object == meta (meaning the object *is* the meta, and should be
  1020.          removed from the system's metaTree -- &ShadowBase->sb_metaTree).
  1021.  
  1022.          Similarly for METH_DESTROY -- don't drop the object's cob_class
  1023.          when you destroy the meta ie: object == object->cob_class), and
  1024.          do transfer the class:
  1025.             if (object == class) IpcARGTransfer(msg, 1);
  1026.  
  1027.  
  1028. INPUTS
  1029.       struct InitMeta *im; - the initialization description.  See includes
  1030.  
  1031. OUTPUTS
  1032.       META           meta; - the meta that was created.  NULL if error.
  1033.  
  1034.  
  1035. RESULT
  1036.  
  1037. BUGS
  1038.       none known.
  1039.  
  1040. NOTES
  1041.  
  1042. SEE ALSO
  1043.       UseObject()
  1044.       DropObject()
  1045.       FindInstanceOfMeta()
  1046.  
  1047. NAME
  1048.       CreateObject -- creates an object with the same data as the ptr.
  1049.  
  1050. SYNOPSIS
  1051.       object = CreateObject( ptr, size )
  1052.         d0                    a0   d0
  1053.  
  1054. FUNCTION
  1055.       This function creates a ClasslessObject, which can be UseObject()'d
  1056.       and DropObject()'d at will, whose included data is the data
  1057.       located in ptr, covering "size" bytes.
  1058.  
  1059.       If given both a non-NULL pointer and non-zero size, it allocates
  1060.       an object of sizeof(struct ClasslessObject)+size and sets up
  1061.       the fields according to what a ClasslessObject should look like:
  1062.  
  1063.             clb_size = size;
  1064.             clb_useCount = 1;
  1065.             clb_class = NULL;
  1066.  
  1067.       As noted, the returned object is Use'd once, so it should be
  1068.       DropObject()'d when its life expires.
  1069.  
  1070.  
  1071. INPUTS
  1072.       void     *ptr; - the object to effect the change upon.
  1073.       ULONG    size; - the size of the data pointed to by ptr.
  1074.  
  1075. OUTPUTS
  1076.       OBJECT object; - the allocated object with the (optional) passed
  1077.                        data.  NULL if error.
  1078.  
  1079.  
  1080. RESULT
  1081.       A new ClasslessObject is created.
  1082.  
  1083. BUGS
  1084.       none known.
  1085.  
  1086. NOTES
  1087.  
  1088. SEE ALSO
  1089.       UseObject()
  1090.       DropObject()
  1091.  
  1092. NAME
  1093.       DestroyMethodTable -- frees the array of methods.
  1094.  
  1095. SYNOPSIS
  1096.       DestroyMethodTable( table )
  1097.                             a0
  1098.  
  1099. FUNCTION
  1100.       This function will destroy the MethodTable's array of
  1101.       MethodHandlers (usually the class' meta_verbs field).
  1102.  
  1103.       It resource-tracks the procObject, defnObject, and method names
  1104.       in the MethodHandler elements.  At this point, the routine will
  1105.       DropObject() or DropIPCPort() or DropString() these fields.
  1106.  
  1107.  
  1108. INPUTS
  1109.       struct MethodTable *table; - required parameter.  Usually found in
  1110.                                     class->meta_verbs.
  1111.  
  1112. OUTPUTS
  1113.  
  1114.  
  1115. RESULT
  1116.       The array, if a non-NULL ptr, is freed.
  1117.  
  1118. BUGS
  1119.       none known.
  1120.  
  1121. NOTES
  1122.  
  1123. SEE ALSO
  1124.       DSM()                            DoShadow()
  1125.       InvalidateCache()
  1126.       SetMethodArgs()
  1127.       AddMethods()
  1128.       FindMethodHandle()
  1129.       BlockMethod()
  1130.       RemoveAllPatches()
  1131.       SetupMethodTags()
  1132.  
  1133. NAME
  1134.       DropObject -- resource tracking for shadow objects.
  1135.  
  1136. SYNOPSIS
  1137.       DropObject( object )
  1138.                     a0
  1139.  
  1140. FUNCTION
  1141.       This function decrements the object's cob_useCount.
  1142.  
  1143.       You should Drop() an object when you free a structure that had a
  1144.       pointer-to-object in it.  In addition, certain method calls, like
  1145.       METH_INIT return an object to you.  When you are done using the
  1146.       pointer, you are expected to drop the pointer.
  1147.  
  1148.       A word about self-referencing.  Self-referncing is an evil problem
  1149.       in useCount systems.  You should DropObject() all self-references
  1150.       during the METH_REMOVE call of an object.  For instance, if your
  1151.       class maintained a binary tree of gadget objects, and these
  1152.       gadget objects pointed back to the window object, the
  1153.       IDCMP_WINDOWCLOSE should do a METH_REMOVE on the window, which in
  1154.       turn should METH_REMOVE it's gadgets, and those gadgets should
  1155.       remove all references to the window object during that METH_REMOVE
  1156.       call.
  1157.  
  1158.       If the useCount of the object drops to zero furing DropObject(),
  1159.       the object's destructor (METH_DESTROY) is called.  If the object
  1160.       in question has no class, than it is assumed to be a
  1161.       ClasslessObject, and the clb_size is looked at.  If this field
  1162.       is non-zero, the object is freed, with
  1163.                      "FreeMem(object, object->clb_size);"
  1164.  
  1165.       You must be careful when designing asynchronous METH_DESTROY
  1166.       methods -- please see IpcItemTransfer() for further details.
  1167.  
  1168.  
  1169. INPUTS
  1170.       OBJECT             object; - the object to effect the change upon.
  1171.  
  1172. OUTPUTS
  1173.  
  1174.  
  1175. RESULT
  1176.  
  1177. BUGS
  1178.       none known.
  1179.  
  1180. NOTES
  1181.  
  1182. SEE ALSO
  1183.       UseObject()
  1184.       IpcItemTransfer()
  1185.       Introduction.doc :: resource tracking
  1186.  
  1187. NAME
  1188.       DropString -- Removes a reference to a system string.
  1189.  
  1190. SYNOPSIS
  1191.       DropString( buffer )
  1192.                     a2
  1193.  
  1194. FUNCTION
  1195.       This function searches the system string list for the system
  1196.       string corresponding to the passed buffer, then decrements
  1197.       the internal usage counter for that system string by one.
  1198.  
  1199.       If the counter becomes zero, that system string is freed from
  1200.       memory.
  1201.  
  1202.       If no string can be found to match buffer, no action is taken.
  1203.  
  1204.  
  1205. INPUTS
  1206.       char *buffer; - equivalent string to the system string that you
  1207.                       want the system to drop a reference to.
  1208.  
  1209. OUTPUTS
  1210.  
  1211.  
  1212. RESULT
  1213.       The system string corresponding to the passed buffer has one
  1214.       fewer references to it.
  1215.  
  1216. BUGS
  1217.       none known.
  1218.  
  1219. NOTES
  1220.       The buffer should be word-aligned for faster access.  long-word
  1221.       aligned is preferred.
  1222.  
  1223. SEE ALSO
  1224.       UseString()
  1225.       QuickUseString()
  1226.       FindString()
  1227.       QuickDropString()
  1228.  
  1229. NAME
  1230.       DSM -- parses out the requested method, calls and/or sends out
  1231.              the appropriate function(s)/message(s)
  1232.  
  1233. SYNOPSIS
  1234.       result = DSM(flags, arguments )
  1235.         d0           d1      a1
  1236.  
  1237. FUNCTION
  1238.       This function is the work horse of the entire system.  It is
  1239.       responsible for sending off all METHODs, whether synchronously,
  1240.       asynchronously, or as a function call.  In addition, it also sends
  1241.       off all method patches as requested.
  1242.  
  1243.       DSM() takes a number of flags which are found in <shadow/message.h>.
  1244.       They are meant to override similar flags which are located in the
  1245.       METHOD_TAG definition of each individual method.  Following is their
  1246.       meaning:
  1247.          INVOKE_CALL       - DEFAULT assumption -- calls method as function
  1248.                               unless specified otherwise in the METHOD_TAG
  1249.  
  1250.          INVOKE_SYNC       - Overrides the method's mtag_threadstat field.
  1251.                               The method is sent as a synchronous message
  1252.                               to the method's destination process [usually
  1253.                               mtag_procObject; see: SetupMethodTags and
  1254.                               INVOKE_WITH_PROCESS], unless the calling
  1255.                               process belongs to a superset (non-proper)
  1256.                               of the destination's process, in which case
  1257.                               the method is called as a function.
  1258.  
  1259.          INVOKE_ASYNC      - Overrides the method's mtag_threadstat field.
  1260.                               The method is sent as an asynchronous message
  1261.                               to the method's destination process [usually
  1262.                               mtag_procObject; see: SetupMethodTags and
  1263.                               INVOKE_WITH_PROCESS], unless the calling
  1264.                               process belongs to a superset (non-proper)
  1265.                               of the destination's process, in which case
  1266.                               the method is called as a function.
  1267.  
  1268.          INVOKE_FORCE      - Used in onjunction with above flags.  See
  1269.                               next three flags.
  1270.  
  1271.          INVOKE_FORCE_SYNC    - Overrides the method's mtag_threadstat field.
  1272.                               The method is sent as a synchronous message
  1273.                               unless the calling process is exactly
  1274.                               equivalent to the destination process, in
  1275.                               which case the method is called as a funcion.
  1276.  
  1277.          INVOKE_FORCE_ASYNC- Overrides the method's mtag_threadstat field.
  1278.                               The method is ALWAYS sent as an asynchronous
  1279.                               message.  Irregardless of calling/destination
  1280.                               process.
  1281.  
  1282.          INVOKE_FORCE_CALL - This is used to override the method's
  1283.                               mtag_threadstat and force a function call
  1284.                               equivalent.
  1285.  
  1286.          INVOKE_WITH_PROCESS-This indicates that the passed argument array
  1287.                               has a preceding process object which should
  1288.                               be used as the destination process for the
  1289.                               method.  The process will only be used
  1290.                               providing that it is required by the method
  1291.                               (ie: that the method is called synchronously
  1292.                                or asynchronously and meets the requirements
  1293.                                of the calling/destination process as
  1294.                                described in the INVOKE_[FORCE_][A]SYNC
  1295.                                flags above), AND if the
  1296.                               INVOKE_IGNORE_PROCESS flag is not set in the
  1297.                               mtag_threadstat field of the method.  The
  1298.                               INVOKE_IGNORE_PROCESS is the exact equivalent
  1299.                               of the INVOKE_WITH_PROCESS.  However, because
  1300.                               of the difference in both meaning and
  1301.                               placement, the INVOKE_WITH_PROCESS flag name
  1302.                               should be used with DSM(), and the
  1303.                               INVOKE_IGNORE_PROCESS should be used with
  1304.                               the mtag_threadstat.
  1305.  
  1306.          INVOKE_FROM_SUPER - This flag indicates the wish to call a passed
  1307.                               class' superclass.  The second field of the
  1308.                               arguments will be -modified- by DSM() to the
  1309.                               class' superclass, and the method then
  1310.                               invoked normally.  Additional doMethod
  1311.                               function callback checking will occur -- both
  1312.                               for the original class and the superclass.
  1313.  
  1314.          INVOKE_FIND_SELECTOR
  1315.                            - The selector is looked up in the system's
  1316.                               hashtable of strings using the FindString()
  1317.                               SHADOW library call.  The address of this
  1318.                               system string is used to select the method
  1319.                               to call.
  1320.  
  1321.          INVOKE_RETURN_MSG - The DSM() call returns a message which can be
  1322.                               used to later generate the actual method as
  1323.                               specified in the passed arguments.  All
  1324.                               resource tracking on the arguments is done
  1325.                               within DSM().  The returned message can
  1326.                               be junk()'d with the JunkIPCMessage()
  1327.                               SHADOW library call, or the method can be
  1328.                               sent as an argument to another function,
  1329.                               and in that method you can call the
  1330.                               ParseShadowMessage() to call the method
  1331.                               associated with the message.  Please see
  1332.                               the examples in ShadowLibFuncs.doc
  1333.                               under the PreParseShadow() .lib function.
  1334.  
  1335.  
  1336.       If the "flags" argument specifies that the methods should be forced
  1337.       to send all methods INVOKE_ASYNC or INVOKE_FORCE_ASYNC, then a single
  1338.       message is sent to the primary handle's procObject asynchronously
  1339.       with the function callback set back to DSM.  When DSM() is then
  1340.       called by the other proces (the message having been parsed out by
  1341.       MessageParse(), usually handled by ParseShadowMessage()), the method
  1342.       and all of its patches are sent out without the INVOKE_ASYNC
  1343.       specification.  This corrects the case where a patch is supposed
  1344.       to be able to -synchronously- control any subsequent patches
  1345.       (METH_FLAG_CHECK_CONTINUE).  Obviously if all methods and all
  1346.       patches were sent out asynchronously, there would be no chance
  1347.       for a synchronous-type behaviour to act correctly.  Therefore,
  1348.       the initial send is asynchronous to the caller, but the complete
  1349.       method handling, including synchronous calling of patches,
  1350.       occurs synchronously to the called process.
  1351.  
  1352.       Consequently, if the method itself (as represented in its METHOD_TAG
  1353.       description) is flagged with INVOKE_FORCE_ASYNC, and DSM() is called
  1354.       with the INVOKE_ASYNC flag, then there are actually -two- messages
  1355.       that are sent.  One is the message described above which handles the
  1356.       synchronous patch-handling asynchronously to the calling process,
  1357.       the other message occurs when the method is processed in the called
  1358.       task -- the method was created as being invoked asynchronously,
  1359.       independently from where it is called, so another message is sent
  1360.       back to the same process!
  1361.  
  1362.       Representing the method as INVOKE_ASYNC, as opposed to
  1363.       INVOKE_FORCE_ASYNC, will avoid this problem, although in this case
  1364.       you may not be able to make the process asynchronous enough to
  1365.       avoid the cases where synchronous behaviour is unwanted.
  1366.  
  1367.       The best way to avoid these problems is to use the
  1368.       INVOKE_FORCE_ASYNC flag in METHOD_TAGs as little as possible, and
  1369.       only call DSM() with the asynchronous flag as needed.  The .lib
  1370.       functions DoShadowAsync(), DoShadowInProcessAsync(), etc. all
  1371.       call DSM() with the INVOKE_ASYNC bit set.
  1372.  
  1373.       If you cannot avoid these issues, you may want to consider creating
  1374.       your own process class for the method, allowing, therefore, an
  1375.       INVOKE_ASYNC bit to correctly be asynchronous to every process
  1376.       -except- when called from within this "double-nested" DSM().
  1377.       In that case, because the calling process and the method-destination
  1378.       process are equivalent, the method is invoked via the function,
  1379.       and not another message.  There is more overhead in creating your
  1380.       own process class (an extra CreateSubClass() call), but it may be
  1381.       worth your trouble....
  1382.  
  1383.  
  1384.  
  1385.       In addition to these passed flags, many of the mtag_flags located in
  1386.       the method description are used to enhance DSM()'s capabilities of
  1387.       sending methods across process boundaries.  These flags can be found
  1388.       in <shadow/misc.h>:
  1389.  
  1390.          METH_FLAG_OBJECT  - The mtag_procObject is interpreted as the
  1391.                               destination process.
  1392.          METH_FLAG_PORT    - The mtag_procObject is interpreted as an
  1393.                               IPCPort to which method-messages are sent.
  1394.          METH_FLAG_CLASS   - The mtag_procObject is interprted as a
  1395.                               class of process objects.  This class is
  1396.                               instantiated, and the resulting process
  1397.                               object is used as the destination for
  1398.                               that particular invocation.
  1399.  
  1400.          METH_FLAG_OBJECT_AS_DEST
  1401.                            - The object inside of the passed arguments
  1402.                               (ie: *(OBJECT *)arguments) is considered the
  1403.                               destination for the method.  This is
  1404.                               particularly useful for process methods which
  1405.                               must (for reasons of port allocation or other
  1406.                               Signal-bit allocation, etc.) be run in the
  1407.                               process with which the process-object
  1408.                               corresponds.
  1409.  
  1410.          METH_FLAG_SPEC    - The mtag_procObject is interpreted as a
  1411.                               pointer to a struct MethInvokeSpec
  1412.                               [see: <shadow/method.h>], the complete
  1413.                               meaning of which depends on the above four
  1414.                               flags in the following manner:
  1415.  
  1416.             METH_FLAG_SPEC | METH_FLAG_OBJECT
  1417.                mis_instanceName is the name of the process object to use
  1418.                                  as the destination object.
  1419.                mis_className    is the class name of the class of the
  1420.                                  above process object.
  1421.                mis_metaName     is the meta's name of the meta of the
  1422.                                  above class.  Usually this is
  1423.                                  META_CLASS.
  1424.  
  1425.             METH_FLAG_SPEC | METH_FLAG_PORT
  1426.                mis_instanceName is the name of the IPCPort to use as the
  1427.                                  destination port.  This port will NOT
  1428.                                  be created, but must exist when the
  1429.                                  method is called.
  1430.                mis_className    is NULL
  1431.                mis_metaName     is NULL
  1432.  
  1433.             METH_FLAG_SPEC | METH_FLAG_CLASS
  1434.                mis_instanceName is NULL
  1435.                mis_className    is the class name of the process to
  1436.                                  create.
  1437.                mis_metName      is the meta's name of the meta of the
  1438.                                  above class.  Usually this is META_CLASS.
  1439.  
  1440.             METH_FLAG_SPEC | METH_FLAG_OBJECT_AS_DEST
  1441.                the METH_FLAG_SPEC is meaningless in this case as the
  1442.                METH_FLAG_OBJECT_AS_DEST never uses the mtag_procObject
  1443.                field.
  1444.  
  1445.  
  1446.                               When the process/port is looked-up/created,
  1447.                               the process/port may replace the
  1448.                               MethInvokeSpec structure, eliminating the
  1449.                               need to lookup the object/class/port again.
  1450.                               To do this, set the SPEC_SAVE_BINDING flag
  1451.                               in the mis_flags field of the MethInvokeSpec
  1452.                               structure.
  1453.  
  1454.  
  1455.       The following METH_FLAGs are passed in at method or patch creation
  1456.       in the MethodTag mtag_flags field:
  1457.  
  1458.             METH_FLAG_[POST|PRE]_BLOCK
  1459.                            - ends the sending of methods off as DSM()
  1460.                               works from the highest priority patch, to
  1461.                               the normal MethodHandle, to the lowest
  1462.                               priority patch.  POST_BLOCK ends the
  1463.                               method chain after -that- method in the
  1464.                               patch-chain is sent off, PRE_BLOCK ends it
  1465.                               BEFORE that method is sent off.
  1466.  
  1467.             METH_FLAG_NO_RTRN
  1468.                            - informs DSM() that a patch or method has no
  1469.                               return value.  By default, all methods and
  1470.                               patches have return values.
  1471.                               Note that this is a change from SHADOW 4!
  1472.  
  1473.             METH_FLAG_CHECK_CONTINUE
  1474.                            - checks the return value returned in d1
  1475.                               (that's d1, not d0).  If d1 is TRUE, then
  1476.                               the method-chain is continued, if FALSE
  1477.                               (zero), then the method chain ends at that
  1478.                               point.
  1479.  
  1480.  
  1481.       A method-chain exists whenever a method is patched.  These patches
  1482.       are called from high priority to zero, when the regular handle is
  1483.       called, and then lower priority patches are called.  This chain
  1484.       of method calls can be terminated by the *_BLOCK or CHECK_CONTINUE
  1485.       flags mentioned above.  Patches are discussed in more detail in both
  1486.       the ShadowLibraryMethods.doc and the Introduction.doc.
  1487.  
  1488.  
  1489.       Thus, we have a picture of DSM().  First, the doMethod() callback of
  1490.       the passed class is checked to see if someone else wants to process
  1491.       the method calls (see NOTE: below).  Then , if necessary,
  1492.       the superclass is loaded and the same doMethod() check is made.
  1493.  
  1494.       The selector is rendered into a  legal system selector, and the
  1495.       method found in the class or class hierarchy.  The method is then
  1496.       checked to see if it's merely a function call, or a series of
  1497.       function/[a]synchronous calls in a patch-chain.  If the former,
  1498.       the method is invoked, if the latter, a series of actions are taken
  1499.       to invoke the method correctly, whether as a function call (as an
  1500.       INVOKE_[A]SYNC might turn out to be), or as a message of some kind,
  1501.       or as a series of function calls and message sends.
  1502.  
  1503.       To avoid headaches, just use the Do*Shadow*() calls in the .lib
  1504.       instead....
  1505.  
  1506. INPUTS
  1507.       void **arguments; - a pointer to the arguments.  First should be the
  1508.                            object, then a valid class, then a method, then
  1509.                            the rest of the arguments according to the
  1510.                            ArgumentTag structure, ending with a METHOD_END
  1511.                            (0x80000001)
  1512.       ULONG      flags; - if low byte non-zero, treat as a specification
  1513.                            for the type of method to send (INVOKE_CALL,
  1514.                            etc.).  A INVOKE_FORCE alone specifies
  1515.                            that the method should be called.  The flag
  1516.                            affects any method patches as well.
  1517.                           INVOKE_SUPER indicates the method should be
  1518.                            sent to the superclass of the class as poassed
  1519.                            in arguments[1].
  1520.                           INVOKE_FIND_METHOD indicates that the method
  1521.                            needs to be lookup up in the systemString via
  1522.                            the FindString call.
  1523.  
  1524. OUTPUTS
  1525.       void *result; - result from method parse.
  1526.  
  1527.  
  1528. RESULT
  1529.  
  1530. BUGS
  1531.       none known.
  1532.  
  1533. NOTES
  1534.       DSM() caches methods for faster lookups (a bit less than thrice as
  1535.       fast in worst case function calls).
  1536.  
  1537.       DSM() checks the class' doMethod function callback both BEFORE and
  1538.       AFTER any INVOKE_SUPER handling.  This callback should act like
  1539.       DSM(), if you want to change the way DSM() works.  The callback
  1540.       does, however, take its parameters in d0/a0 not d1/a1.  The callback
  1541.       is located in the class structure -- inside of the struct CoreClass,
  1542.       to be exact [<shadow/coreMeta.h>].  As DSM() searches up the class
  1543.       hierarchy for the method, each class' doMethod() callback is
  1544.       checked.  if it exists, the function is then called.
  1545.  
  1546.       Use the Do*Shadow*() method calls instead!
  1547. SEE ALSO
  1548.                                        Do*Shadow*()
  1549.       InvalidateCache()
  1550.       SetMethodArgs()
  1551.       AddMethods()
  1552.       DestroyMethodTable()
  1553.       FindMethodHandle()
  1554.       BlockMethod()
  1555.       RemoveAllPatches()
  1556.       SetupMethodTags()
  1557.  
  1558. NAME
  1559.       FindAttrDefn -- Finds the attribute structure in the class
  1560.  
  1561. SYNOPSIS
  1562.       attribute = FindAttrDefn( class, name )
  1563.          d0                       a0    a1
  1564.  
  1565. FUNCTION
  1566.       This function finds the Attribute structure (the element in the
  1567.       class' array) of the specified class.
  1568.  
  1569.       If the class has a callback attribute function, that function is
  1570.       called instead.
  1571.  
  1572.       Otherwise, the array is radix searched for the attribute whose
  1573.       name corresponds to FindString(name).
  1574.  
  1575.  
  1576. INPUTS
  1577.       META         class; - the class whose attribute is wanted
  1578.                              returns NULL for a NULL class.
  1579.       char         *name; - the name of the attribute to find.
  1580.  
  1581. OUTPUTS
  1582.       struct Attribute *attribute; - pointer to the Attribute structure as
  1583.                                       specified in the class.
  1584.  
  1585.  
  1586. RESULT
  1587.  
  1588. BUGS
  1589.       none known.
  1590.  
  1591. NOTES
  1592.       The attribute callback function is called:
  1593.          ccl_attrDefnFunc() and is located in the struct CoreClass
  1594.       described in <shadow/coreMeta.h>.
  1595.  
  1596. SEE ALSO
  1597.       PrepareAttrTags()                   FindString()
  1598.       AddAttributes()
  1599.       CopyDefaultAttributes()
  1600.       FreeAttributes()
  1601.       FindAttribute()
  1602.  
  1603. NAME
  1604.       FindAttribute -- Finds the instance of the attribute in the object
  1605.  
  1606. SYNOPSIS
  1607.       attribute = FindAttribute( object, name )
  1608.          d0                        a0     a1
  1609.  
  1610. FUNCTION
  1611.       This function will find the specified structure inside of the object
  1612.       and return the address of that structure.
  1613.  
  1614.       Calls FindAttrDefn() on the object's class.
  1615.  
  1616.  
  1617. INPUTS
  1618.       OBJECT             object; - the object whose attribute is wanted.
  1619.                                     returns NULL for a NULL object, or
  1620.                                     an object with a NULL class.
  1621.       char                *name; - the name of the attribute to find.
  1622.  
  1623. OUTPUTS
  1624.       void *attribute; - pointer to the object's attribute.  This
  1625.                           pointer points to the insides of an object.
  1626.  
  1627.  
  1628. RESULT
  1629.  
  1630. BUGS
  1631.       none known.
  1632.  
  1633. NOTES
  1634.       Calls FindAttrDefn internally.
  1635.  
  1636. SEE ALSO
  1637.       PrepareAttrTags()
  1638.       AddAttributes()
  1639.       CopyDefaultAttributes()
  1640.       FreeAttributes()
  1641.       FindAttrDefn()
  1642.  
  1643. NAME
  1644.       FindInstanceOfMeta -- Bi-level search for instances of a Meta (Classes!)
  1645.  
  1646. SYNOPSIS
  1647.       class = FindInstanceOfMeta( className, metaName )
  1648.         d0                            a0        a1
  1649.  
  1650. FUNCTION
  1651.       This function is useful for finding a Class.  A Class always resides
  1652.       in the ATTR_INSTANCETREE of its defining Meta (until removed via the
  1653.       METH_REMOVE method).  The Metas all reside in ShadowBase->sb_metaTree.
  1654.       Therefore, it takes two FindWatchedTreeStringNode() calls to find a
  1655.       class (or Cluster).
  1656.  
  1657.       This is how FindShadowClass() and FindShadowCluster() are #defined....
  1658.  
  1659.  
  1660. INPUTS
  1661.       char *className; - the name of the class you are looking for.
  1662.       char  *metaName; - the name of the Meta that the class is in.
  1663.  
  1664. OUTPUTS
  1665.       OBJECT    class; - the pointer to the class.  NULL if can't find.
  1666.  
  1667. RESULT
  1668.  
  1669. BUGS
  1670.       none known.
  1671.  
  1672. NOTES
  1673.       You should DropObject() the class when you are finished using it.
  1674.  
  1675.  
  1676. SEE ALSO
  1677.       UseObject()
  1678.       DropObject()
  1679.       CreateMeta()
  1680.       FindNamedObject()
  1681.  
  1682. NAME
  1683.       FindMethodHandle -- finds the associated handle in the class.
  1684.  
  1685. SYNOPSIS
  1686.       handle = FindMethodHandle( class, method )
  1687.         d0                         a0     a1
  1688.  
  1689. FUNCTION
  1690.       This function will search the class' verb table for the
  1691.       required method.  It does not look in any superclasses to
  1692.       find it.
  1693.  
  1694.  
  1695. INPUTS
  1696.       META      class; - the (optional) class in which to find the method.
  1697.       char    *method; - the name of the method to look for.  MUST be the
  1698.                           system string equivalent (you can get this from
  1699.                           the FindString() function.
  1700.  
  1701. OUTPUTS
  1702.       struct MethodHandle *handle; - the returned handle.  NULL if not
  1703.                                       found.
  1704.  
  1705.  
  1706. RESULT
  1707.  
  1708. BUGS
  1709.       none known.
  1710.  
  1711. NOTES
  1712.  
  1713. SEE ALSO
  1714.       DSM()                            DoShadow()
  1715.       InvalidateCache()
  1716.       SetMethodArgs()
  1717.       AddMethods()
  1718.       DestroyMethodTable()
  1719.       BlockMethod()
  1720.       RemoveAllPatches()
  1721.       SetupMethodTags()
  1722.  
  1723. NAME
  1724.       FindNamedObject -- Tri-level search for instances of a Class of a Meta
  1725.  
  1726. SYNOPSIS
  1727.       object = FindNamedObject( instanceName, className, metaName )
  1728.         d0                            d0          a0        a1
  1729.  
  1730. FUNCTION
  1731.       This function is useful for finding a named OBJECT like a process.
  1732.       A Process' Class always resides in the ATTR_INSTANCETREE of its
  1733.       defining Meta (until removed via the METH_REMOVE method).  Likewise,
  1734.       the process OBJECT always resides in the ATTR_INSTANCETREE of its
  1735.       defining process class.  Therefore, it takes three
  1736.       FindWatchedTreeStrngNode() calls to find a named object.
  1737.  
  1738.  
  1739. INPUTS
  1740.       char *instanceName; - the name of the object we're looking for.
  1741.       char *className   ; - the name of the class you are looking for.
  1742.       char  *metaName   ; - the name of the Meta that the class is in.
  1743.  
  1744. OUTPUTS
  1745.       OBJECT   object   ; - the pointer to the object.  NULL if can't find.
  1746.  
  1747. RESULT
  1748.  
  1749. BUGS
  1750.       none known.
  1751.  
  1752. NOTES
  1753.       You should DropObject() this object when you are finished using it.
  1754.  
  1755.  
  1756. SEE ALSO
  1757.       UseObject()
  1758.       DropObject()
  1759.       CreateMeta()
  1760.       FindInstanceOfMeta()
  1761.  
  1762. NAME
  1763.       FindNodePriInSList -- Finds an object in the singly linked list
  1764.  
  1765. SYNOPSIS
  1766.       object = FindNodePriInSList( list, pri, name )
  1767.         d0                          a0    d0   a1
  1768.  
  1769. FUNCTION
  1770.       This function finds an object in a singly linked list with the
  1771.       given name at the given priority (list is ordered by
  1772.       priority).
  1773.  
  1774.  
  1775. INPUTS
  1776.       SList               *list; - a pointer to the list in which to find
  1777.                                     the object.
  1778.       long                  pri; - the priority
  1779.       char                *name; - the name it was added as.
  1780.  
  1781.  
  1782. OUTPUTS
  1783.       OBJECT             object; - the object, if found.  NULL otherwise.
  1784.  
  1785.  
  1786. RESULT
  1787.  
  1788. BUGS
  1789.       none known.
  1790.  
  1791. NOTES
  1792.       The found object is UseObject()'d, please DropObject() it when you
  1793.       are finished using the pointer.
  1794.  
  1795. SEE ALSO
  1796.       AddSListNode()                      AddWatchedSListNode()
  1797.       RemoveSListNode()                   RemoveWatchedSListNode()
  1798.  
  1799.       UseObject()
  1800.       DropObject()
  1801.  
  1802. NAME
  1803.       FindString -- Find a system string
  1804.  
  1805. SYNOPSIS
  1806.       string = FindString( buffer )
  1807.         d0                   a2
  1808.  
  1809. FUNCTION
  1810.       This function hashes the buffer string and searches on the
  1811.       collision binary tree for any matches.
  1812.  
  1813.       It will return the system string, if it finds it.  It will NOT
  1814.       increment the internal useCount, so you should not use what is
  1815.       returned as either a system string, nor even as a string, but
  1816.       merely as an address you are searching a table for -- and
  1817.       even then, you must be careful of race conditions, the address
  1818.       should remain valid for the entire time you are searching a
  1819.       table or structure, or the table/structure must be locked in
  1820.       memory during the time you look up the string and the time
  1821.       you are searching the table.
  1822.  
  1823.  
  1824. INPUTS
  1825.       char *buffer; - the buffer whose system string you want to find.
  1826.                                                 Given a NULL, will
  1827.                                                 return a NULL
  1828.  
  1829. OUTPUTS
  1830.       char *string; - the string, if found.  NULL if no string.
  1831.  
  1832.  
  1833. RESULT
  1834.  
  1835. BUGS
  1836.       none known.
  1837.  
  1838. NOTES
  1839.       The buffer should be word-aligned for fast access and long-word
  1840.       aligned for fastest access.
  1841.  
  1842. SEE ALSO
  1843.       UseString()
  1844.       QuickUseString()
  1845.       DropString()
  1846.       QuickDropString();
  1847.  
  1848. NAME
  1849.       FindTreeNode -- Finds the object in the binary tree
  1850.  
  1851. SYNOPSIS
  1852.       object = FindTreeNode( bt, key )
  1853.         d0                   a0  d0
  1854.  
  1855. FUNCTION
  1856.       This function returns the first object in the binary tree that matched
  1857.       the key passed to the function.
  1858.  
  1859.       Note that a corollary function FindTreeStringNode() is usually defined
  1860.       as FindTreeNode(bt, FindString(name)).
  1861.  
  1862.       The object is Used() via the UseObject() call.  When the pointer that
  1863.       is returned is no longer needed, it should be Drop()'d via the
  1864.       DropObject() call.
  1865.  
  1866.  
  1867. INPUTS
  1868.       AVLTREE   *bt; - a pointer to the root of the binary tree.
  1869.       ULONG     key; - the key to look for.
  1870.  
  1871. OUTPUTS
  1872.       OBJECT object; - the object that is found
  1873.  
  1874.       NULL is returned if no object is found.
  1875.  
  1876. RESULT
  1877.       The node is located in the binary tree.
  1878.  
  1879. BUGS
  1880.       none known.
  1881.  
  1882. NOTES
  1883.       Please DropObject() any objects returned when no longer needed.
  1884.       Remember that the keys are sorted unsigned, not signed.
  1885.  
  1886. SEE ALSO
  1887.       UseObject()/DropObject()
  1888.  
  1889.       AddTreeNode()              AddWatchedTreeNode()
  1890.       AddTreeStringNode()        AddWatchedTreeStringNode()
  1891.       FreeTreeAllNodes()         RemoveWatchedTreeNode()
  1892.       RecurseTree()              RemoveWatchedTreeStringNode()
  1893.       RemoveTreeNode()
  1894.       RemoveTreeStringNode()
  1895.  
  1896. NAME
  1897.       FreeTreeAllNodes -- Frees all nodes in a particular binary tree
  1898.  
  1899. SYNOPSIS
  1900.       FreeTreeAllNodes( bt )
  1901.                         a0
  1902.  
  1903. FUNCTION
  1904.       This function will remove all nodes off of the binary tree, dropping
  1905.       all objects, and all strings.
  1906.  
  1907.       The binary tree is assumed to contain objects sorted on a string as
  1908.       a key.  Please do not call it on any other type of binary tree, as
  1909.       it would be dropping potentially non-existant string objects.
  1910.  
  1911.       V4.2 UPDATE!  You may now call it with a binary tree that is sorted
  1912.       on keys identical to the pointer to the objects each node holds.
  1913.          ie: keys added with:
  1914.                AddTreeNode(&bt, object, object);
  1915.       -or- with keys of less than 256, which are assumed to be merely
  1916.       longwords and not pointers to strings....
  1917.  
  1918.  
  1919. INPUTS
  1920.       AVLTREE *bt; - a pointer to the root of the binary tree.
  1921.  
  1922. OUTPUTS
  1923.  
  1924.  
  1925. RESULT
  1926.       bt is now a pointer to an empty binary tree.
  1927.  
  1928. BUGS
  1929.       none known.
  1930.  
  1931. NOTES
  1932.       Don't call this function on a binary tree sorted by keys that aren't
  1933.       system strings, aren't less than 256 and aren't equal to the
  1934.       corresponding object.
  1935.  
  1936. SEE ALSO
  1937.       AddTreeNode()              AddWatchedTreeNode()
  1938.       AddTreeStringNode()        AddWatchedTreeStringNode()
  1939.       FindTreeNode()             RemoveWatchedTreeNode()
  1940.       RecurseTree()              RemoveWatchedTreeStringNode()
  1941.       RemoveTreeNode()
  1942.       RemoveTreeStringNode()
  1943.  
  1944. NAME
  1945.       FreeAttributes -- Frees all Attribute structures for the class
  1946.  
  1947. SYNOPSIS
  1948.       FreeAttributes( table )
  1949.                         a0
  1950.  
  1951. FUNCTION
  1952.       This function will free the array of Attributes in the
  1953.       AttributeTable.  Called during METH_DESTROY for classes and metas.
  1954.  
  1955.  
  1956. INPUTS
  1957.       struct AttributeTable *table; - pointer to the attribute table to
  1958.                                        free.  Probably a pointer into a
  1959.                                        class that is going away.
  1960.  
  1961. OUTPUTS
  1962.       none
  1963.  
  1964.  
  1965. RESULT
  1966.       The memory allocated in that table is freed.  The Table structure
  1967.       itself is NOT freed.
  1968.  
  1969. BUGS
  1970.       Should probably be called DestroyAttributeTable()
  1971.  
  1972. NOTES
  1973.       table is a required parameter
  1974.       This is a system function, and probably not something that you will
  1975.       need to call.
  1976.  
  1977. SEE ALSO
  1978.       PrepareAttrTags()
  1979.       AddAttributes()
  1980.       CopyDefaultAttributes()
  1981.       FindAttribute()
  1982.       FindAttrDefn()
  1983.  
  1984. NAME
  1985.       FreeClassWatchers -- frees all the watchers in the class' attributes
  1986.  
  1987. SYNOPSIS
  1988.       FreeClassWatchers( class )
  1989.                            a0
  1990.  
  1991. FUNCTION
  1992.       This function frees all watchers left on any of the class'
  1993.       attribute-watching SLists.
  1994.  
  1995.  
  1996. INPUTS
  1997.       META class; - the class whose attributes' watchers need to be
  1998.                      removed.
  1999.  
  2000. OUTPUTS
  2001.  
  2002.  
  2003. RESULT
  2004.       All watchers in a class are removed.
  2005.  
  2006. BUGS
  2007.       none known.
  2008.  
  2009. NOTES
  2010.       For some reason, class watchers need to be removed from the class
  2011.       when the class is removed.
  2012.  
  2013.       Therefore, the METH_REMOVE for metas and roots calls this function.
  2014.  
  2015. SEE ALSO
  2016.       FreeObjectWatchers()
  2017.       AddClassWatcher()
  2018.  
  2019. NAME
  2020.       FreeItem -- Frees an element belonging to a MemoryList
  2021.  
  2022. SYNOPSIS
  2023.       FreeItem( list, ptr )
  2024.                  a0   a1
  2025.  
  2026. FUNCTION
  2027.       This function frees an element that was allocated via the
  2028.       AllocateItem() function.  The element may, or may not, be returned
  2029.       to Exec's free memory pool, but may, thereafter, be re-used by
  2030.       AllocateItem() for some other program.
  2031.  
  2032.  
  2033. INPUTS
  2034.       SEMLIST list; - the MemoryList the element belongs to.
  2035.       void    *ptr; - the element pointer
  2036.  
  2037. OUTPUTS
  2038.  
  2039.  
  2040. RESULT
  2041.       The element is returned to be re-used by AllocateItem for the
  2042.       specified MemoryList.
  2043.  
  2044.  
  2045. BUGS
  2046.       Infinite loop occurs if ptr was not on the MemoryList to begin with.
  2047.  
  2048. NOTES
  2049.       The MemoryList passed MUST be the MemoryList from which the element
  2050.       was allocated.
  2051.  
  2052. SEE ALSO
  2053.       InitTable()
  2054.       AllocateItem()
  2055.       FreeTable()
  2056.  
  2057. NAME
  2058.       FreeObjectWatchers -- frees all the watchers in the object's vars.
  2059.  
  2060. SYNOPSIS
  2061.       FreeObjectWatchers( object )
  2062.                             a0
  2063.  
  2064. FUNCTION
  2065.       This function removes all watchers from all variables in the object.
  2066.  
  2067.  
  2068. INPUTS
  2069.       OBJECT object; - the object whose watched variables need to be
  2070.                         removed.
  2071.  
  2072. OUTPUTS
  2073.  
  2074.  
  2075. RESULT
  2076.       All watchers of all watched variables in the object are removed.
  2077.  
  2078. BUGS
  2079.       none known.
  2080.  
  2081. NOTES
  2082.       This function, as opposed to FreeClassWatchers(), can be called in
  2083.       the METH_DESTROY.  The Metas and Roots currently call this function.
  2084.  
  2085. SEE ALSO
  2086.       FreeClassWatchers()
  2087.       AddClassWatcher()
  2088.  
  2089. NAME
  2090.       FreeTable -- free all the memory nodes on the MemoryList
  2091.  
  2092. SYNOPSIS
  2093.       FreeTable( list )
  2094.                   a0
  2095.  
  2096. FUNCTION
  2097.       This function frees all resources that the MemoryList acquired
  2098.       during run-time.  This means that any outstanding MemoryNodes are
  2099.       thereafter freed -- and therefore not usable to whomever may own
  2100.       them.  No attempt is made to ensure all items have been released
  2101.       before all outstanding MemoryNodes are freed by the freefunc()
  2102.       originally passed to InitTable.
  2103.  
  2104.       FreeItem automatically frees MemoryNodes when it "feels" there are
  2105.       plenty of free elements available for use.  However, that means
  2106.       that even when all elements are FreeItem()'d, there will still be
  2107.       many MemoryNodes on the MemoryList.  This function will free those
  2108.       remaining MemoryNodes.
  2109.  
  2110.  
  2111. INPUTS
  2112.       SEMLIST *list; - the MemoryList to purge.
  2113.  
  2114. OUTPUTS
  2115.  
  2116.  
  2117. RESULT
  2118.       The MemoryList no longer contains any outstanding resources.
  2119.  
  2120. BUGS
  2121.       none known.
  2122.  
  2123. NOTES
  2124.       The notion of '"feels" there are plenty of free elements' is
  2125.       intentionally vague.
  2126.  
  2127. SEE ALSO
  2128.       InitTable()
  2129.       AllocateItem()
  2130.       FreeItem()
  2131.  
  2132. NAME
  2133.       GetObject -- Semaphored access to an object in a public area.
  2134.  
  2135. SYNOPSIS
  2136.       object = GetObject(objectPtr )
  2137.         d0                  a1
  2138.  
  2139. FUNCTION
  2140.       In some attributes, there may be object pointers that you need
  2141.       to retrieve from that attribute.  On the other hand, somebody else
  2142.       might change it at the same time.
  2143.  
  2144.       This function uses the ShadowBase->sb_semSemaphore to protect the
  2145.       access to the objectPtr.  The object that is returned is returned
  2146.       Use()'d, so when you are done with the object you should call
  2147.       DropObject(object) on it.
  2148.  
  2149.  
  2150. INPUTS
  2151.       OBJECT  *objectPtr; - the pointer to the structure element that
  2152.                              holds the object pointer you want.
  2153. OUTPUTS
  2154.       void       *object; - the object that *objectPtr points to.
  2155.  
  2156. RESULT
  2157.       object returned is UseObject()d once.
  2158.  
  2159. BUGS
  2160.       none known.
  2161.  
  2162. NOTES
  2163.  
  2164. SEE ALSO
  2165.       RemoveObject()
  2166.       SetObject()
  2167.  
  2168. NAME
  2169.       GetShadowError -- Get an error code from SHADOW
  2170.  
  2171. SYNOPSIS
  2172.       result = GetShadowError()
  2173.       d0/d1
  2174.  
  2175. FUNCTION
  2176.       This function retrieves the last SHADOW error and suberror that
  2177.       occurred within the calling process' context.
  2178.  
  2179.       This is useful to use when you need to differentiate between
  2180.       a failure to send a message, and an asynchronous send which ALWAYS
  2181.       returns a NULL, or a successful, but NULL-returning, method.
  2182.  
  2183.       You should ClearShadowError() first, of course....
  2184.  
  2185.          /*
  2186.           * The following is included for clarity, but is actually
  2187.           * present in the shadow_proto.h include file.
  2188.           */
  2189.          #define ClearShadowError()  SetShadowError(0,0);
  2190.  
  2191.          .
  2192.          .
  2193.          .
  2194.  
  2195.          union {
  2196.             double tempD;
  2197.             ULONG  tempV[2];
  2198.          } retval;
  2199.  
  2200.          ClearShadowError()
  2201.          if (!DoShadow(object, NULL, DO_SOMETHING, METHOD_END))
  2202.          {
  2203.             retval = GetShadowError();
  2204.             /*
  2205.              * tempV[0] is the error code.
  2206.              * tempV[1] is reserved at the moment, and is garbage for now.
  2207.              */
  2208.             switch(errorCode = retval.tempV[0])
  2209.             {
  2210.                /*
  2211.                 * The following flags are from misc.h
  2212.                 */
  2213.                case 0:
  2214.                   /*
  2215.                    * No Error!
  2216.                    */
  2217.                case NO_SHADOW_PROCESS:
  2218.                   /*
  2219.                    * Could not retrieve an error because the current
  2220.                    * process is not registered with SHADOW.
  2221.                    */
  2222.                case CANNOT_ALLOCATE_OBJECT:
  2223.                   /*
  2224.                    * SHADOW could not allocate a new object.
  2225.                    */
  2226.                case CANNOT_ALLOCATE_PROCESS:
  2227.                   /*
  2228.                    * The method was supposed to invoke a process to
  2229.                    * handle it, but failed to create the process.
  2230.                    */
  2231.                case CANNOT_SEND_MESSAGE:
  2232.                   /*
  2233.                    * Either:
  2234.                    *    a) port is blocked.
  2235.                    *    b) no process to send to/from.
  2236.                    *    c) message could not be allocated.
  2237.                    */
  2238.                case CANNOT_FIND_METHOD:
  2239.                   /*
  2240.                    * Could not find a method to send to!
  2241.                    */
  2242.                default:
  2243.             }
  2244.             }
  2245.          }
  2246.  
  2247.  
  2248. INPUTS
  2249.       <none>
  2250.  
  2251. OUTPUTS
  2252.       double               result; - low 32bits (d0) are the error, High
  2253.                                      32bits (d1) are the error subcode.
  2254.                                      Be careful if your compiler starts
  2255.                                      checking for a double return in the
  2256.                                      68881 processor, instead of d0/d1!!!
  2257.  
  2258.  
  2259. RESULT
  2260.  
  2261. BUGS
  2262.       none known.
  2263.  
  2264. NOTES
  2265.  
  2266. SEE ALSO
  2267.       SetShadowError
  2268.  
  2269. NAME
  2270.       GetTagsSize -- gets the size of a NULL terminated aray.
  2271.  
  2272. SYNOPSIS
  2273.       size = GetTagsSize( tags, size )
  2274.        d0                  a0    d0
  2275.  
  2276. FUNCTION
  2277.       This function will find the size of a longword-NULL-terminated
  2278.       array. The NULL termination should be valid for the first longword
  2279.       of the last array element.
  2280.  
  2281.       The passed size should be the size of each array element.
  2282.  
  2283.  
  2284. INPUTS
  2285.       void *tags; - a pointer to the array.  If NULL, returns NULL
  2286.       long  size; - the size of each element in the array.
  2287.  
  2288. OUTPUTS
  2289.       long  size; - the size of the array, including the NULL element.
  2290.  
  2291.  
  2292. RESULT
  2293.  
  2294. BUGS
  2295.       none known.
  2296.  
  2297. NOTES
  2298.  
  2299. SEE ALSO
  2300.  
  2301. NAME
  2302.       InitOOProgram -- initialize an AmigaDOS process as a shadow process
  2303.  
  2304. SYNOPSIS
  2305.       result = InitOOProgram( name )
  2306.         d0                     a0
  2307.  
  2308. FUNCTION
  2309.       This function will initialize the calling amigaDos process as
  2310.       a SHADOW process.  This means that tc_UserData is HANDS OFF from
  2311.       that point on ('cept for read only).  The process object is stored
  2312.       in tc_UserData and all message ports, etc. are allocated.
  2313.  
  2314.       This function MUST be called before initiating any non-CALL methods.
  2315.       Any methods that would require a SYNC or an ASYNC message
  2316.       require that a process object exist in tc_UserData of the calling
  2317.       task.
  2318.  
  2319.       If you want to use something other than PROCESS_CLASS, then you may
  2320.       first set FindTask(NULL)->tc_UserData to NULL, then call METH_SUB
  2321.       on the process class, then send that class a METH_CREATE, then
  2322.       send the object that that returns a METH_ASSOCIATE.  That's all
  2323.       this function does....  [Excepting the METH_SUB call, of
  2324.       course....]  Please be sure NOT to use the object that is returned
  2325.       (that is, do NOT DropObject() the returned process object!!!!)
  2326.  
  2327.       There is an example of this sans the mETH_SUB call in
  2328.       ShadowLibraryMethods.doc under the METH_PROC_ASSOCIATE method
  2329.       description.
  2330.  
  2331.  
  2332.  
  2333. INPUTS
  2334.       char *name; - the name to give the process object.
  2335.  
  2336.       The name defaults to FindTask(NULL)->tc_Node.ln_Name when passed in
  2337.       as NULL.
  2338.  
  2339. OUTPUTS
  2340.       BOOL result; - result code
  2341.  
  2342.       The result code is a boolean describing success or failure of process
  2343.       object creation.
  2344.  
  2345.       FALSE (0) is an error.
  2346.  
  2347.  
  2348. RESULT
  2349.       Process object is created for the calling task.
  2350.  
  2351. BUGS
  2352.       none known.
  2353.  
  2354. NOTES
  2355.       tc_UserData is trashed (used)
  2356.  
  2357. SEE ALSO
  2358.       RemoveCurrentProgram()
  2359.  
  2360. NAME
  2361.       InitTable -- Initializes a memory table.
  2362.  
  2363. SYNOPSIS
  2364.       result = InitTable( list, allocfunc, freefunc, size )
  2365.         d0                 a0      a1         d0      d1
  2366.  
  2367. FUNCTION
  2368.  
  2369.       Shadow requires a number of very small elements to be coninually
  2370.       allocated and freed.  This function initializes a struct MemoryList
  2371.       which attempts to ease the strain on AllocMem and FreeMem by
  2372.       allocating and freeing blocks that are 32 times "size".
  2373.  
  2374.       The individual elements are allocated via the AllocateItem() and
  2375.       FreeItem() functions.
  2376.  
  2377.       InitTable initializes the various parts of the passed MemoryList
  2378.       structure.
  2379.  
  2380.  
  2381. INPUTS
  2382.       SEMLIST list;                 - a MemoryList to initialize.
  2383.       TABLENODE allocfunc(SEMLIST); - an allocation function that, given a
  2384.          d0                 a0         MemoryList, returns a MemoryNode
  2385.                                        structure as a header to 32
  2386.                                        elements to be doled out by
  2387.                                        AllocateItem().  If passed as NULL,
  2388.                                        the system uses an internal routine.
  2389.       void freefunc(SEMLIST, TABLENODE);
  2390.                       a0        a1  - a free function that, given a
  2391.                                        MemoryList and a MemoryNode, frees
  2392.                                        the Node plus the 32 elements from
  2393.                                        the List.  If passed as NULL, the
  2394.                                        system uses an internal routine.
  2395.       long size                     - the size of each element.
  2396.  
  2397. OUTPUTS
  2398.       BOOL result;                  - result code
  2399.  
  2400.       The result code is a boolean indicating the success or failure of
  2401.       the function call.  A zero value indicates that an error occured.
  2402.  
  2403.  
  2404. RESULT
  2405.       The specified list is initilized, the first 32 elements are
  2406.       allocated, the semaphore is initialized, the memlst_semUse flag in
  2407.       the structure is set to TRUE, and the memlst_size set to the
  2408.       passed size.
  2409.  
  2410. BUGS
  2411.       none known.
  2412.  
  2413. NOTES
  2414.       It's not very flexible, but it's used for BinNodes, semaphores,
  2415.       list, and MethInvokeSpec internal structures.  It's got pretty good,
  2416.       but not fantastic, performance.  See "PerfTest MEMORY" results.
  2417.  
  2418. SEE ALSO
  2419.  
  2420.       AllocateItem()
  2421.       FreeItem()
  2422.       FreeTable()
  2423.  
  2424. NAME
  2425.       InitThread -- initializes the process object associated with the task.
  2426.  
  2427. SYNOPSIS
  2428.       task = InitThread( task )
  2429.        d0                 a0
  2430.  
  2431. FUNCTION
  2432.       This function is no longer valid under SHADOW V.  If you have been
  2433.       calling it and need directions on how to update your software,
  2434.       please see both the ShadowLibraryMethods.doc and the
  2435.       Introduction.doc about the PROCESS_CLASS.
  2436.  
  2437. NOTES
  2438.       SUPERCEDED!
  2439.  
  2440. NAME
  2441.       InsertSuperClass -- Take known class and insert another superclass level
  2442.  
  2443. SYNOPSIS
  2444.       InsertSuperClass( subClass, newSuperClass )
  2445.                             a0          a1
  2446.  
  2447. FUNCTION
  2448.       This function is useful for adding methods to a Class.  Unfortunately,
  2449.       it is currently impossible to remove these same methods once added,
  2450.       so be very careful with what you're doing here!
  2451.  
  2452.       Basically, this function takes the old superclass and makes the
  2453.       newSuperClass the old subclass' superclass.  This function also
  2454.       flushes the entire method cache as it assumes that some method
  2455.       cache lines might be incorrect.
  2456.  
  2457.  
  2458. INPUTS
  2459.       META      subClass; - the subclass whose superclass will be changed.
  2460.                             If NULL, no harm will come.
  2461.       META newSuperClass; - the new superClass for the passed subClass
  2462.                             if NULL, the old superClass will remain.
  2463.  
  2464. OUTPUTS
  2465.       <none>
  2466.  
  2467. RESULT
  2468.  
  2469. BUGS
  2470.       none known.
  2471.  
  2472. NOTES
  2473.       The newSuperClass is "swallowed" by this function.  if you want to
  2474.       keep the newSuperClass pointer valid within your sequence of
  2475.       execution after this call, you will need to do something like:
  2476.          InsertSuperClass(old, UseObject(new));
  2477.  
  2478.       This function is only valid if the new superclass is, itself, a
  2479.       subclass of the old subclass' superclass.  IE:
  2480.                Class A
  2481.                   |
  2482.                   /\
  2483.                  /  \
  2484.             Class B  Class C
  2485.                         \
  2486.                          \
  2487.                         Class D
  2488.  
  2489.          It is valid to make Class B's new superclass either Class C or
  2490.          Class D. However, Class D cannot have its superclass reset to
  2491.          class B.
  2492.  
  2493.       No class may be its own superclass!  Such a class would never go away!
  2494.  
  2495.       You may NOT add any new attributes with this call.  That is, the
  2496.       newSuperClass must not have any new attributes not located in the
  2497.       oldSubClass.  In addition, if you define default values for the
  2498.       existing attributes, these default attributes will NOT propagate
  2499.       down to the oldSubClass.  This function is meant to add METHODS
  2500.       ONLY!  Do not attempt to use it for anything else or you will be
  2501.       burnt.
  2502.  
  2503.  
  2504. SEE ALSO
  2505.       UseObject()
  2506.       DropObject()
  2507.       CreateMeta()
  2508.  
  2509. NAME
  2510.       InvalidateCache -- invalidates cache entries
  2511.  
  2512. SYNOPSIS
  2513.       InvalidateCache( class, selector )
  2514.                         a0
  2515.  
  2516. FUNCTION
  2517.       This function will invalidate all entries in the method's cache that
  2518.       refer to the passed class and/or the passed selector.
  2519.  
  2520.       If passed a NULL class, then every entry in the cache that contains a
  2521.       selector field that matches the address of the passed selector is
  2522.       cleared.  You should call this whenever you create a selector on the
  2523.       stack, or in memory, and then free the associated memory.
  2524.  
  2525.       If passed a NULL selector, then every entry in the cache that
  2526.       contains a class field that matches the address of passed class is
  2527.       cleared.  You should call this whenever a class is free'd.
  2528.  
  2529.       if both fields are NULL, then the entire cache is flushed.  This is
  2530.       called whenever a program exits from memory.  That's because there
  2531.       are many methods which become invalid at that point, but
  2532.       invalidating all of them would be tedious, so the entire cache is
  2533.       flushed.  Notice that that's with every PROGRAM, NOT every PROCESS.
  2534.  
  2535.       If both fields are passed in as non-NULL, then cache entries are
  2536.       only freed for those entries that match both the class and the
  2537.       selector.  However, I haven't found a good use for this case.
  2538.       Perhaps you folks can?
  2539.  
  2540.  
  2541. INPUTS
  2542.       META *class;    - a class.
  2543.       char *selector; - a method selector
  2544.  
  2545. OUTPUTS
  2546.  
  2547.  
  2548. RESULT
  2549.       No more references to a defunct class exists in the method calling
  2550.       cache.  No more references to the defunct selectors exists in the
  2551.       method calling cache.
  2552.  
  2553. BUGS
  2554.       none known.
  2555.  
  2556. NOTES
  2557.  
  2558. SEE ALSO
  2559.       DSM()                            DoShadow()
  2560.       SetMethodArgs()
  2561.       AddMethods()
  2562.       DestroyMethodTable()
  2563.       FindMethodHandle()
  2564.       BlockMethod()
  2565.       RemoveAllPatches()
  2566.       SetupMethodTags()
  2567.  
  2568. NAME
  2569.       IpcItemTransfer -- Transfers a resource from message to server.
  2570.  
  2571. SYNOPSIS
  2572.       IpcItemTransfer( msg, num )
  2573.                         a0   d0
  2574.  
  2575. FUNCTION
  2576.       This function will transfer the resource found in the num'th
  2577.       item in msg to the calling server.
  2578.  
  2579.       Basically, the IPC_ITEM_TRANSFER flag is cleared, and the
  2580.       IPC_SERVER_OWNED flag is set.
  2581.  
  2582.       This is very important to do when inside of a METH_DESTROY
  2583.       method.  You need to transfer the passed object out of the message!
  2584.  
  2585. INPUTS
  2586.       struct IPCMessage *msg; - the (possibly NULL) message to xfer
  2587.                                  resources from.  If msg is NULL, no
  2588.                                  action is taken.
  2589.       long               num; - the item number where the resource is
  2590.                                  currently located.
  2591.  
  2592. OUTPUTS
  2593.       none
  2594.  
  2595.  
  2596. RESULT
  2597.       resource is no longer valid in the message.
  2598.  
  2599. BUGS
  2600.       none known.
  2601.  
  2602. NOTES
  2603.  
  2604. SEE ALSO
  2605.       IpcARGTransfer() macro
  2606.       ppipc.library documentation.  Not included in SHADOW, but available
  2607.       on a Fred Fish disk.
  2608.  
  2609. NAME
  2610.       JunkIPCMessage -- Frees a message allocated by MessageMaker
  2611.  
  2612. SYNOPSIS
  2613.       JunkIPCMessage( msg )
  2614.                        a0
  2615.  
  2616. FUNCTION
  2617.       This function will delete an IPCMessage, releasing all resources
  2618.       which have not been IpcItemTransfer()'d.
  2619.  
  2620.       The message itself is also deleted.
  2621.  
  2622.       Message should have been allocated by MessageMaker, although that is
  2623.       not the only legal case, it is the safest route to compatibility.
  2624.       The PreParseShadow() function calls the MessageMaker() internally.
  2625.  
  2626.  
  2627. INPUTS
  2628.       struct IPCMessage *msg; - the message to delete.  If NULL, no action
  2629.                                  is taken.
  2630.  
  2631. OUTPUTS
  2632.       none
  2633.  
  2634.  
  2635. RESULT
  2636.       One more message is gone.
  2637.  
  2638. BUGS
  2639.       none known.
  2640.  
  2641. NOTES
  2642.  
  2643. SEE ALSO
  2644.       MessageMaker()
  2645.       IpcItemTransfer()
  2646.  
  2647. NAME
  2648.       MessageMaker -- Creates a Message for the given MethodHandle & args.
  2649.  
  2650. SYNOPSIS
  2651.       msg = MessageMaker( handle, args )
  2652.        d0                   a0     a1
  2653.  
  2654. FUNCTION
  2655.       This function will create a ppipc message that MessageParse()
  2656.       and ParseShadowMessage() can unroll in order to call a method
  2657.       asynchronously across tasks.
  2658.  
  2659.       Full resource tracking is done, and all resources are freed
  2660.       during the JunkIPCMessage() call, unless an IpcItemTransfer()
  2661.       was performed for that resource's item.
  2662.  
  2663.       IpcItemTransfer should be done during METH_DESTROY.
  2664.  
  2665.  
  2666. INPUTS
  2667.       struct MethodHandle *handle; - the method that the message should
  2668.                                       serve.  Set the low bit of the
  2669.                                       address if this is actually a ptr
  2670.                                       into a MethodHandle object as
  2671.                                       returned from PatcherClass INIT.
  2672.       void                 **args; - the arguments that should be placed,
  2673.                                       one by one, into the message
  2674.                                       structure.  Full resource
  2675.                                       tracking will be done for these
  2676.                                       arguments according to the
  2677.                                       ArgumentTag structure, so the message
  2678.                                       can be sent asynchronously.
  2679.  
  2680. OUTPUTS
  2681.       struct IPCMessage *msg; - The returned message.
  2682.  
  2683.  
  2684. RESULT
  2685.       A new message is constructed.
  2686.  
  2687. BUGS
  2688.       none known.
  2689.  
  2690. NOTES
  2691.  
  2692. SEE ALSO
  2693.       JunkIPCMessage()
  2694.       DropObject()
  2695.       SetMethodArgs()
  2696.       ParseShadowMessage()
  2697.       MessageParse()
  2698.  
  2699. NAME
  2700.       MessageParse -- Parses a message onto the stack.
  2701.  
  2702. SYNOPSIS
  2703.       value = MessageParse( msg )
  2704.         d0                   a0
  2705.  
  2706. FUNCTION
  2707.       This function will parse a message onto the stack according to the
  2708.       ArgumentTag structure as passed inside of the message.  The
  2709.       message must have exactly the right number of items, or bad
  2710.       things may happen.
  2711.  
  2712.       The Method is then called, and its return value returned in d0.
  2713.  
  2714.       There is also some magic which allows DSM() to be called as the
  2715.       function, so that methods which are forced ASYNC by the flags
  2716.       in an original DSM() call, actually work properly....
  2717.  
  2718.  
  2719. INPUTS
  2720.       struct IPCMessage *msg; - should be a valid message set up by
  2721.                                  MessageMaker().
  2722.  
  2723. OUTPUTS
  2724.       void *value; - the return value of the method call.
  2725.  
  2726.  
  2727. RESULT
  2728.       The METHOD is called.
  2729.  
  2730. BUGS
  2731.       none known.
  2732.  
  2733. NOTES
  2734.  
  2735. SEE ALSO
  2736.       MethodFuncParse()
  2737.       DSM()
  2738.       MessageMaker()
  2739.  
  2740. NAME
  2741.       MethodFuncParse -- Copies the stack arguments back to the stack.
  2742.  
  2743. SYNOPSIS
  2744.       return = MethodFuncParse( object, class, args, handle, flags )
  2745.        d0/d1                      d0       d1    a1    a2     d7
  2746.  
  2747. FUNCTION
  2748.       This function will copy the arguments found in args onto the stack,
  2749.       according to the ArgumentTag structure found in handle.
  2750.  
  2751.       Unlike MessageParse(), it must deal with missing arguments -- ie:
  2752.       it may encounter METHOD_END (0x80000001) before the end of the
  2753.       ArgumentTag argument array.  The missing arguments are NULL'd out,
  2754.       then it calls the method function, and returns d0/d1 as a double.
  2755.  
  2756.       D0 is what should normally be considered as the return value.
  2757.       DSM() is incapable of returning real doubles at the current time.
  2758.       D1 is used by DSM() for its METH_FLAG_CHECK_CONTINUE.
  2759.       ParseShadowMessage() has some magic for storing D1 away for
  2760.       synchronous method calls.
  2761.  
  2762.       The 'msg' parameter of all Methods is NULL'd by MethodFuncParse().
  2763.  
  2764.  
  2765. INPUTS
  2766.       OBJECT                object; - the object being called.
  2767.       META                  *class; - the class the method is defined in.
  2768.       void                  **args; - the (other) arguments to the
  2769.                                        function.
  2770.       struct MethodHandler  *handle;- the method's handle
  2771.       ULONG                 flags;  - set this field to zero for now.  This
  2772.                                        field reserved by system for future
  2773.                                        expansion and current asynchronous
  2774.                                        magic.
  2775.  
  2776. OUTPUTS
  2777.       double return; - the return value is usually considered D0, but D1
  2778.                         is used by DSM() for its _CONTINUE checking.
  2779.  
  2780.  
  2781. RESULT
  2782.       The METHOD was called.
  2783.  
  2784. BUGS
  2785.       none known.
  2786.  
  2787. NOTES
  2788.  
  2789. SEE ALSO
  2790.       MessageParse()
  2791.       DSM()
  2792.       ParseShadowMessage()
  2793.  
  2794. NAME
  2795.       ParseShadowMessage -- parses the three types of SHADOW messages
  2796.  
  2797. SYNOPSIS
  2798.       return = ParseShadowMessage( msg, flags )
  2799.         d0                          a0   d0
  2800.  
  2801. FUNCTION
  2802.       This function parses the three types of messages that SHADOW
  2803.       programs can receive -- AMET, SMET and JAZZ.
  2804.  
  2805.       AMET message are asynchronous messages, and these message are
  2806.       correctly handled by MessageParse().  The message is Junk()'d via
  2807.       the JunkIPCMessage call.
  2808.  
  2809.       SMET messages are synchronous message and these message are
  2810.       correctly handled by MethodFuncParse().  The message is
  2811.       replied to when MethodFuncParse() is finished.
  2812.  
  2813.       JAZZ messages are message you can send.  The function pointer should
  2814.       be in the first element of the message, and the single argument to
  2815.       the function should be in the second argument.  No value is
  2816.       currently returned -- but if someone needs to, please let me know.
  2817.       They are currently unused.  The message is returned when the
  2818.       function is finished.
  2819.  
  2820.       The flags override certain features of this function.  There
  2821.       are currently three flags:
  2822.          SHADOW_RETURN_MSG_ALWAYS
  2823.          SHADOW_RETURN_MSG_NEVER
  2824.          SHADOW_RETURN_MSG_ON_FAILURE
  2825.  
  2826.       By default (SHADOW_MSG_RETURN_NEVER), messages are always swallowed
  2827.       by this function.  If you wish the message to neither be replied to
  2828.       or Junk()d via the JunkIPCMessage() call, call the function with the
  2829.       SHADOW_RETURN_MSG_ALWAYS.  The msg will then be returned to you for
  2830.       whatver further processing you wish....
  2831.  
  2832.       If you don't know whether this is a SHADOW message or not, you can
  2833.       call the function with the SHADOW_RETURN_MSG_ON_FAILURE.  If the
  2834.       message is not an AMET, SMET or JAZZ message, the msg will be
  2835.       returned to you for further processing.  Note, however, that the
  2836.       assumption is that the message -is- a struct IPCMessage, and not
  2837.       some other form of message (like struct IntuiMessage, for instance).
  2838.       You have been warned.
  2839.  
  2840.       For the default behaviour, pass in the SHADOW_RETURN_MSG_NEVER
  2841.       flag.  This was the old behaviour of ParseJazzMessage() under SHADOW
  2842.       4.
  2843.  
  2844. INPUTS
  2845.       struct IPCMessage *msg; - a message sent to a SHADOW task's port.
  2846.       ULONG flags;            - one of three flags.
  2847.  
  2848. OUTPUTS
  2849.       struct IPCMessage *return; - exact return is dependent on the flags
  2850.                                     passed into ParseShadowMessage().
  2851.  
  2852.  
  2853. RESULT
  2854.       The correct function is called.
  2855.  
  2856. BUGS
  2857.       Does not handle unknown messages without replyports properly under
  2858.       the SHADOW_RETURN_MSG_NEVER mode.
  2859.       So don't send them!
  2860.  
  2861. NOTES
  2862.  
  2863. SEE ALSO
  2864.       MessageParse()
  2865.       MethodFuncParse()
  2866.  
  2867. NAME
  2868.       PrepareAttrTags -- Prepares Attribute tags for class definition
  2869.  
  2870. SYNOPSIS
  2871.       num = PrepareAttrTags( tags, countptr, super )
  2872.        d0                     a0      d1      a1
  2873.  
  2874. FUNCTION
  2875.       This function is designed specifically because of the inherent
  2876.       trickiness of Metas.
  2877.  
  2878.       Under normal situations, the functionality of this function would be
  2879.       incorporated into AddAttributes().  Unfortunately, because Metas
  2880.       are their own classes, the size of the Meta depends on the
  2881.       definitions held in the defining AttributeTags.  Therefore, the Meta
  2882.       cannot be allocated until it knows the required size, it wouldn't
  2883.       know the size until the AddAttributes call, but it can't call
  2884.       AddAttributes until the Meta exists so that the AttributeTable
  2885.       pointer can be passed in.
  2886.  
  2887.       At anyrate, this function determines the number of new attribute
  2888.       there are (returned num) and the additional size that will be
  2889.       needed (by incrementing the *countptr for each new attribute).
  2890.  
  2891.       Attributes which are already contained within the super are
  2892.       cheerfully ignored.  Respecified Attributes are assumed to be
  2893.       attempts to redefine the default value, not to respecify an
  2894.       attribute's size.
  2895.  
  2896.       You probably won't need to use this function, unless you are
  2897.       creating your own Meta or METHODs for Metas.
  2898.  
  2899.  
  2900. INPUTS
  2901.       ATTRIBUTE_TAG       tags[]; - optional pointer to a NULL terminated
  2902.                                      array of AttributeTags.
  2903.       long             *countptr; - initialized pointer to the long which
  2904.                                      will be incremented by the additional
  2905.                                      size required by the passed
  2906.                                      attributes.  If any attributes are
  2907.                                      redefined (from the super), the size
  2908.                                      will not be incremented for that
  2909.                                      attribute.
  2910.       META                *super; - optional pointer to a superclass.
  2911.  
  2912. OUTPUTS
  2913.       long                num; - number of new attributes (does not
  2914.                                   include attributes redefined from the
  2915.                                   passed super.
  2916.  
  2917.  
  2918. RESULT
  2919.       The countptr variable is incremented by the additional size, above
  2920.       and beyond the size of 'super', that the passed attribute tags would
  2921.       require.
  2922.  
  2923. BUGS
  2924.       none known.
  2925.  
  2926. NOTES
  2927.       *countptr MUST be initialized, probably to the size of the
  2928.       superClass, as the size of the superClass is not used in calculating
  2929.       the size (*countPtr) in this function.
  2930.  
  2931. SEE ALSO
  2932.       AddAttributes()
  2933.       CopyDefaultAttributes()
  2934.       FreeAttributes()
  2935.       FindAttribute()
  2936.       FindAttrDefn()
  2937.  
  2938. NAME
  2939.       PSem -- procures the semaphore for the given address.
  2940.  
  2941. SYNOPSIS
  2942.       result = PSem( address, flags )
  2943.         d0             a0       d0
  2944.  
  2945. FUNCTION
  2946.  
  2947.       Copious documentation on the PSem() function is provided for in the
  2948.       Introduction.doc.  Please see it if this AutoDoc does not answer
  2949.       your questions....
  2950.  
  2951.       This function semaphores the given address dictated by the
  2952.       following flags:
  2953.  
  2954.          SSEM_READ
  2955.          SSEM_ATTEMPT
  2956.          SSEM_WRITE
  2957.          SSEM_LOCK       (SSEM_READ | SSEM_WRITE)
  2958.  
  2959.       In addition, several other flags alter the semaphoring code:
  2960.  
  2961.          SSEM_VARIABLE   0x8
  2962.          SSEM_MAX        0x10
  2963.          SSEM_SUBTRACT   0x80000000
  2964.          SSEM_DESTROY    0x20
  2965.  
  2966.  
  2967.       The following macros have been built around PSem() to add
  2968.       readability:
  2969.  
  2970.          /*
  2971.           * Conditional variables
  2972.           */
  2973.          SetCondition(address,number)\
  2974.             PSem(address, SSEM_VARIABLE | SSEM_READ | ((-number) << 8))
  2975.          WaitCondition(address,number)\
  2976.             PSem(address, SSEM_VARIABLE | SSEM_READ | (number << 8))
  2977.          CreateCondition()           PSem((void *)-1, SSEM_VARIABLE)
  2978.          DestroyCondition(address)\
  2979.             PSem(address, SSEM_VARIABLE | SSEM_DESTROY)
  2980.  
  2981.          /*
  2982.           * Level-triggered semaphores.
  2983.           */
  2984.          WaitLevel(address)\
  2985.             PSem(address, SSEM_ATTEMPT|SSEM_WRITE);\
  2986.             PSem(address, SSEM_READ);\
  2987.             VSem(address)
  2988.          SetLevel(address)\
  2989.             VSem(address);
  2990.  
  2991.          /*
  2992.           * "Sticky" semaphores
  2993.           */
  2994.          CreateSemaphore(count)      PSem((void *)-1, SSEM_MAX | (count << 8))
  2995.          DestroySemaphore(address)   PSem(address, SSEM_DESTROY)
  2996.  
  2997.          /*
  2998.           * Couting semaphores of various kinds.
  2999.           */
  3000.          ObtainNumber(address,num)   PSem(address, SSEM_READ | (num << 8))
  3001.          ReleaseNumber(address, num) PSem(address, SSEM_READ | ((-num) << 8))
  3002.          UpCountSem(address,max)     PSem(address, SSEM_READ | SSEM_MAX |\
  3003.                                                   (max << 8))
  3004.          DownCountSem(address)       VSem(address)
  3005.  
  3006.          /*
  3007.           * Locks
  3008.           */
  3009.          WriteLock(address)          PSem(address, SSEM_WRITE)
  3010.          ReadLock(address)           PSem(address, SSEM_READ)
  3011.          RWLock(address)             PSem(address, SSEM_READ | SSEM_WRITE)
  3012.  
  3013.  
  3014.       If anyone else attempts to semaphore the same address (via PSem),
  3015.       the system takes appropriate action (according to the flags).
  3016.  
  3017.       if the system cannot allocate a sempahore object internally,
  3018.       a busy loop with a Delay(30) is used until it can.  You
  3019.       are guaranteed that, when PSem returns, you have a lock o
  3020.       the semaphore -- unless SSEM_ATTEMPT is used, in which case you must
  3021.       look at the return code.
  3022.  
  3023.  
  3024. INPUTS
  3025.       void *address; - Any address within the system.  (-1) is reserved
  3026.                         as allocating a new semaphore -- that semaphore
  3027.                         address would be returned....
  3028.       ULONG flags;   - some combination of the flags above.
  3029.  
  3030. OUTPUTS
  3031.       void *result;  - result code for SSEM_ATTEMPT.  Otherwise, returns
  3032.                         semaphore address.  This will be equivalent to
  3033.                         the argument "address", or the allocated semaphore
  3034.                         address if "address" is (-1).
  3035.                         The result code for SSEM_ATTEMPT is (1L) for
  3036.                         success and NULL for failure.
  3037.  
  3038.  
  3039. RESULT
  3040.       The specified semaphore action will have taken place.
  3041.  
  3042. BUGS
  3043.       none known.
  3044.  
  3045. NOTES
  3046.  
  3047.       Although it is not strictly necessary, you will undoutedly encounter
  3048.       bugs if the address on which you have a semaphore is freed before the
  3049.       semaphore is.  Mostly because another task may then allocate that
  3050.       address, and attempt a semaphore on it -- leading to unexpected
  3051.       deadly embrace conditions.
  3052.  
  3053.       The address passed need not point to an object, as the BinTree and
  3054.       List code require.
  3055.  
  3056. SEE ALSO
  3057.       From exec.library:
  3058.          ObtainSemaphore()
  3059.          ObtainSemaphoreShared()
  3060.          AttemptSemaphore()
  3061.  
  3062.       VSem()
  3063.  
  3064.       Introduction.doc
  3065.  
  3066. NAME
  3067.       PSemString -- used to ensure single-thread startup.
  3068.  
  3069. SYNOPSIS
  3070.       result = PSemString( char  *string, long semFlags )
  3071.                                 a0             d0
  3072.  
  3073. FUNCTION
  3074.       Does the following:
  3075.          return PSem(UseString(string), semFlags);
  3076.  
  3077.       The browser uses this function to ensure that only a single
  3078.       copy of itself is running.
  3079.  
  3080.  
  3081. INPUTS
  3082.       char     *string; - the system string equivalent which is used to
  3083.                            semaphore thread startup.
  3084.       long    semFlags; - the flags to send to PSem().
  3085.  
  3086. OUTPUTS
  3087.       void    *result;  - result code for SSEM_ATTEMPT.  Otherwise, returns
  3088.                            semaphore address.  This will be equivalent to
  3089.                            the argument "address", or the allocated semaphore
  3090.                            address if "address" is (-1).
  3091.                            The result code for SSEM_ATTEMPT is (1L) for
  3092.                            success and NULL for failure.
  3093.  
  3094. RESULT
  3095.  
  3096. BUGS
  3097.       none known.
  3098.  
  3099. NOTES
  3100.  
  3101. SEE ALSO
  3102.       VSemString()
  3103.       PSem()
  3104.       VSem()
  3105.  
  3106. NAME
  3107.       QuickDropString -- Decrements the useCount of a known system string.
  3108.  
  3109. SYNOPSIS
  3110.       QuickDropString( string )
  3111.                          a2
  3112.  
  3113. FUNCTION
  3114.       This function decrements the useCount of a known system string.
  3115.       The passed string *must* be a pointer to a system string.
  3116.  
  3117.       If the useCount drops to zero, DropString is automatically called
  3118.       in order to delete the string object from the correct place in
  3119.       the system's string hash table.
  3120.  
  3121.       Therefore, only call QuickDropString when you think you will have
  3122.       more than one reference to them.  That allows QDS() to work
  3123.       fastest.
  3124.  
  3125. INPUTS
  3126.       char *string; - the string to lower the refcounts of the system string.
  3127.  
  3128. OUTPUTS
  3129.  
  3130. RESULT
  3131.       The given system string has had its useCount decremented.
  3132.  
  3133. BUGS
  3134.       none known.
  3135.  
  3136. NOTES
  3137.  
  3138. SEE ALSO
  3139.       UseString()
  3140.       QuickUseString()
  3141.       FindString()
  3142.       DropString()
  3143.  
  3144. NAME
  3145.       QuickUseString -- Increment the usage counter of a system string.
  3146.  
  3147. SYNOPSIS
  3148.       string = QuickUseString( string )
  3149.         d0                       a2
  3150.  
  3151. FUNCTION
  3152.       This function increments the system usage counter for a string
  3153.       that you already know is a system string.  This must be the
  3154.       *address* of the system string, not a buffer pointer equivalent.
  3155.  
  3156.       If you pass in a NULL, this function returns a NULL.
  3157.  
  3158.       You should UseString() whenever saving  a suitable string into
  3159.       a structure -- a matching DropString() will then deallocate the
  3160.       reference.  Under the appropriate conditions (mentioned above)
  3161.       you may use QuickUseString() to avoid the hash and binary search
  3162.       calls.
  3163.  
  3164.  
  3165. INPUTS
  3166.       char *string; - the system string whose useCount should be incremented
  3167.  
  3168. OUTPUTS
  3169.       char *string; - the system string.
  3170.  
  3171.       Exactly what was passed into it!
  3172.  
  3173.  
  3174. RESULT
  3175.       The system string's internal useCount is incremented
  3176.  
  3177. BUGS
  3178.       none known.
  3179.  
  3180. NOTES
  3181.       Don't pass in arbitrary buffer pointers or you may risk overwriting
  3182.       your stack, or memory.
  3183.  
  3184. SEE ALSO
  3185.       UseString()
  3186.       FindString()
  3187.       DropString()
  3188.       QuickDropString()
  3189.  
  3190. NAME
  3191.       RecurseTree -- Recursively call a function on each BinNode of an
  3192.                         AVLTREE
  3193.  
  3194. SYNOPSIS
  3195.       result = RecurseTree( bt, func, data, recurse )
  3196.         d0                  a0   a1    d0     d1
  3197.  
  3198. FUNCTION
  3199.       This function will recurse through the binary tree, calling func()
  3200.       for each object found with the parameters 'object key data', where
  3201.       object is the object in the binary tree, key is the key that the
  3202.       object is sorted on, and data is the data passed into the Recurse()
  3203.       call.
  3204.  
  3205.       If this func() ever returns non-NULL, the recursion is stopped, and
  3206.       the non_NULL return code is returned to the caller of RecurseTree.
  3207.  
  3208.       There are three different ways to recurse through a binary tree.
  3209.       The following flags are defined in shadow/bintree.h:
  3210.  
  3211.          SHADOW_RECURSE_INORDER     == 1
  3212.          SHADOW_RECURSE_PREORDER    == 2
  3213.          SHADOW_RECURSE_POSTORDER   == 3
  3214.          SHADOW_RECURSE_BACKORDER   == 4
  3215.  
  3216.       The order of the recursion is determined by these flags passed as
  3217.       the recurse parameter.  INORDER outputs the left children, then the
  3218.       root, then the right children.  PREORDER outputs the root, the left,
  3219.       then the right.  POSTORDER outputs the left, the right, then the
  3220.       root.  BACKORDER outputs the right, the root, then the left.
  3221.  
  3222.  
  3223. INPUTS
  3224.       AVLTREE *bt;                         - the binary tree to recurse
  3225.                                               over.
  3226.       void *(*func)(void *, ULONG, void *) - the function.  return value
  3227.                      a0      d0     a1       used below.  Return NULL to
  3228.                                              continue recursive calling,
  3229.                                              non-NULL to end recursive calls.
  3230.                                              Three parameters are:
  3231.                                               object, key, data.
  3232.                                              See above.
  3233.       void *data                           - the passed data
  3234.       long recurse                         - the recurse type flag.
  3235.  
  3236. OUTPUTS
  3237.  
  3238.       void *result; - returns non-NULL result of func() if func() ever
  3239.                       returns non-NULL.  Else returns NULL.
  3240.  
  3241. RESULT
  3242.       func() called for each element in the binary tree.
  3243.  
  3244. BUGS
  3245.       None known.
  3246.  
  3247. NOTES
  3248.       Do NOT RemoveTreeNode() the object from the binary tree that you
  3249.       are recursing through in the passed function.  AND do not call any
  3250.       methods that would....
  3251.  
  3252.       Remember that the keys are sorted unsigned, not signed.
  3253.  
  3254. SEE ALSO
  3255.       AddTreeNode()              AddWatchedTreeNode()
  3256.       AddTreeStringNode()        AddWatchedTreeStringNode()
  3257.       FindTreeNode()             RemoveWatchedTreeNode()
  3258.       FreeTreeAllNodes()         RemoveWatchedTreeStringNode()
  3259.       RemoveTreeNode()
  3260.       RemoveTreeStringNode()
  3261.  
  3262. NAME
  3263.       RemoveAllPatches -- Removes all Patches from a given class.
  3264.  
  3265. SYNOPSIS
  3266.       RemoveAllPatches( meta )
  3267.                          a0
  3268.  
  3269. FUNCTION
  3270.       This function will remove all of the method patches of a given
  3271.       class.  This should be executed when deleting a class in which
  3272.       methods could be patched.
  3273.  
  3274.       It is currently called in the META_DESTROY of the metaclass and the
  3275.       metaCluster.
  3276.  
  3277.       Because of this, it is IMPOSSIBLE to patch the METH_DESTROY
  3278.       method for any metas, because they are their own classes -- the
  3279.       function that would call RemoveALlPatches may be in a method-chain,
  3280.       which would not be valid when control returned to DSM() to continue
  3281.       the method chain.  This would be confusing, at best.... :(
  3282.  
  3283.  
  3284. INPUTS
  3285.       META  meta; - the class to delete all the patches from.
  3286.  
  3287. OUTPUTS
  3288.  
  3289.  
  3290. RESULT
  3291.  
  3292. BUGS
  3293.       none known.
  3294.  
  3295. NOTES
  3296.  
  3297. SEE ALSO
  3298.       DSM()                            DoShadow()
  3299.       InvalidateCache()
  3300.       SetMethodArgs()
  3301.       AddMethods()
  3302.       DestroyMethodTable()
  3303.       FindMethodHandle()
  3304.       BlockMethod()
  3305.       SetupMethodTags()
  3306.  
  3307. NAME
  3308.       RemoveAutoResource -- Removes resource from process' tracking tree.
  3309.  
  3310. SYNOPSIS
  3311.       resource = RemoveAutoResource( task, resource, key )
  3312.          d0                           a0      d0     a1
  3313.  
  3314.  
  3315. FUNCTION
  3316.       The resource, which is found using the resource/key pair, is
  3317.       removed from the process' ATTR_RESOURCETREE and returned back
  3318.       to your control.  No METH_REMOVE is done, and you must
  3319.       DropObject() the resource which is returned.
  3320.  
  3321.       Task parameter is optional and defaults to the current task.
  3322.       Resource parameter is optional, and defaults to whatever
  3323.       resource is found using the provided key.  (If key >255, then
  3324.       key is assumed to be a string, and is handled accordingly.)
  3325.  
  3326. INPUTS
  3327.       OBJECT                 task; - The optional task object that performs
  3328.                                       the auto-tracking.  If not specified,
  3329.                                       assumes current taskObject.
  3330.       OBJECT             resource; - The optional object being auto-tracked.
  3331.                                       If no resource, then resource is
  3332.                                       looked up on the binary tree using
  3333.                                       the value in key.
  3334.       char                   *key; - The name of the resource.  Resources
  3335.                                       without names are stored by their
  3336.                                       addresses.  Name addresses of 0-255
  3337.                                       are reserved for priority freeing.
  3338.                                       Resources are freed in INCREASING
  3339.                                       key order.
  3340.  
  3341. OUTPUTS
  3342.       OBJECT             resource; - The resource as found.  You must
  3343.                                       DropObject() the returned resource
  3344.                                       when you are no longer interested in
  3345.                                       it.  Eventually, you must
  3346.                                       RemoveObject() the resource when the
  3347.                                       resource is no longer needed
  3348.                                       -anywhere-!
  3349.  
  3350. RESULT
  3351.  
  3352. BUGS
  3353.       none known.
  3354.  
  3355. NOTES
  3356.  
  3357. SEE ALSO
  3358.       AddAutoResource()
  3359.       DropObject()
  3360.  
  3361. NAME
  3362.       RemoveClassWatcher -- Removes a watcher from all classes.
  3363.  
  3364. SYNOPSIS
  3365.       RemoveClassWatcher( watchName, director, name, class )
  3366.                               a0        a1      d0     d1
  3367.  
  3368. FUNCTION
  3369.       This function will remove the director from the class' attribute
  3370.       watching SList of the passed name.  This is a low-level routine.
  3371.       You should call the DIRECTOR_CLASS routines instead.  See browser.c,
  3372.       or ShadowLibraryMethods.doc.
  3373.  
  3374.  
  3375. INPUTS
  3376.       char             *watchName; - the attribute name that is watched
  3377.       OBJECT             director; - the director to Remove from the
  3378.                                       attribute watching SList.
  3379.       char                  *name; - the name of the watcher.
  3380.       META                  class; - the class to remove the watcher from.
  3381.  
  3382. OUTPUTS
  3383.       none
  3384.  
  3385. RESULT
  3386.       The director is removed from the class' watch list.
  3387.  
  3388. BUGS
  3389.       none known.
  3390.  
  3391. NOTES
  3392.  
  3393. SEE ALSO
  3394.       AddWatcherNode()
  3395.       RemoveWatcherNode()
  3396.       AddClassWatcher()
  3397.  
  3398. NAME
  3399.       RemoveCurrentProgram -- removes the current process from the system.
  3400.  
  3401. SYNOPSIS
  3402.       RemoveCurrentProgram( semaphore )
  3403.                                a0
  3404.  
  3405. FUNCTION
  3406.       This function is the counterpart of InitOOProgram().  It removes an
  3407.       AmigaDOS loaded program from the system so that that program can exit
  3408.       safely.
  3409.  
  3410.       This is S.O.P. for cleaning up a -program-.
  3411.  
  3412.       RemoveCurrentProgram() waits for no other process to own a reference
  3413.       to the process associated with the program.  While it does this, it
  3414.       handles messages on jp_port and jp_replyPort (struct ShadowProcess).
  3415.  
  3416.       This function sends a METH_REMOVE to the processObject, and waits on
  3417.       the process' jp_port and jp->replyPort for messages (which it manages
  3418.       by taking everything off the list, handling the messages, then
  3419.       checking for more signals).  It also waits for a ^C and then checks
  3420.       that jp_parent is NULL.
  3421.  
  3422.       A program may create many threads on itself.  When INIT'ing a process
  3423.       object, one parameter that the programmer can pass is a SEMF.  This
  3424.       is a pointer to a semaphore that is passed into the process creation
  3425.       code.  It is ObtainShared() during the process startup, and
  3426.       Release()'d when the thread is done executing.
  3427.  
  3428.       RemoveCurrentProgram() waits on this semaphore until all threads
  3429.       have exited before removing the program's process object.
  3430.  
  3431.       A NULL semaphore is dealt with appropriately.
  3432.  
  3433.  
  3434. INPUTS
  3435.       struct SignalSemaphore *semaphore; - the thread semaphore
  3436.  
  3437. OUTPUTS
  3438.  
  3439.  
  3440. RESULT
  3441.       The program's process object is removed and associated ports freed.
  3442.  
  3443. BUGS
  3444.       none known.
  3445.  
  3446. NOTES
  3447.  
  3448. SEE ALSO
  3449.       InitOOProgram()
  3450.  
  3451. NAME
  3452.       RemoveObject -- send a METH_REMOVE to an object.
  3453.  
  3454. SYNOPSIS
  3455.       RemoveObject( OBJECT object )
  3456.                         a0
  3457.  
  3458. FUNCTION
  3459.       Does a:
  3460.          DoShadow(object, NULL, METH_REMOVE, METHOD_END);
  3461.       Followed by a:
  3462.          DropObject(object);
  3463.  
  3464.       This removes the object from the system lists, and from your local
  3465.       sequence of execution.  You should not refer to "object" after
  3466.       you pass it into this function unless you have maintained an
  3467.       additional usage of the object as in:
  3468.          RemoveObject(UseObject(object);
  3469.          /*
  3470.           * I can still use object!
  3471.           */
  3472.          .
  3473.          .
  3474.          .
  3475.          DropObject(object);
  3476.  
  3477. INPUTS
  3478.       OBJECT      object; - the object to send the Remove method to.
  3479.  
  3480. OUTPUTS
  3481.       none.
  3482.  
  3483. RESULT
  3484.  
  3485. BUGS
  3486.       none known.
  3487.  
  3488. NOTES
  3489.  
  3490. SEE ALSO
  3491.       CreateInstance()  -- in ShadowLibFuncs.doc
  3492.       CreateSubClass()  -- in ShadowLibFuncs.doc
  3493.  
  3494. NAME
  3495.       RemoveSListNode -- removes a node from a prioritized, singly-linked
  3496.                           list.
  3497.  
  3498. SYNOPSIS
  3499.       result = RemoveSListNode( list, object, name )
  3500.         d0                       a0     a1     d1
  3501.  
  3502. FUNCTION
  3503.       This function removes an object from a singly linked list with the
  3504.       given name.
  3505.  
  3506.  
  3507. INPUTS
  3508.       SList               *list; - a pointer to the list from which to
  3509.                                     remove the object.
  3510.       OBJECT             object; - the object to remove.
  3511.       char                *name; - the name it was added as.
  3512.  
  3513.  
  3514. OUTPUTS
  3515.       BOOL result; - result code
  3516.  
  3517.       returns FALSE if can't find the node to Remove.
  3518.  
  3519.  
  3520. RESULT
  3521.       One fewer nodes are on the list.
  3522.  
  3523. BUGS
  3524.       none known.
  3525.  
  3526. NOTES
  3527.  
  3528. SEE ALSO
  3529.       FindNodePriInSList()                AddWatchedSListNode()
  3530.       AddSListNode()                      RemoveWatchedSListNode()
  3531.  
  3532. NAME
  3533.       RemoveThread -- removes a previously initialized thread.
  3534.  
  3535. SYNOPSIS
  3536.       RemoveThread( object )
  3537.                       a0
  3538.  
  3539. FUNCTION
  3540.       This function is no longer valid under SHADOW V.  If you have been
  3541.       calling it and need directions on how to update your software,
  3542.       please see both the ShadowLibraryMethods.doc and the
  3543.       Introduction.doc about the PROCESS_CLASS.
  3544.  
  3545. NAME
  3546.       RemoveTreeNode -- Removes a node from a binary tree
  3547.  
  3548. SYNOPSIS
  3549.       result = RemoveTreeNode( bt, object, key )
  3550.         d0                     a0    a1    d0
  3551.  
  3552. FUNCTION
  3553.       This function will remove an object from the binary tree,
  3554.       dropping it via DropObject().
  3555.  
  3556.       The object pointer is required to verify the correct node is
  3557.       being removed (in case nodes with the same key exist in the
  3558.       same tree).
  3559.  
  3560.  
  3561. INPUTS
  3562.       AVLTREE               *bt; - a pointer to the root of the binary tree.
  3563.       OBJECT             object; - the object to add into the tree.
  3564.       ULONG                 key; - the key value to insert on.
  3565.  
  3566. OUTPUTS
  3567.       BOOL result
  3568.  
  3569.       returns FALSE on failure to remove.
  3570.  
  3571.  
  3572. RESULT
  3573.       The object exists in the tree at least one fewer times than it did.
  3574.  
  3575. BUGS
  3576.       none known.
  3577.  
  3578. NOTES
  3579.       Remember that the keys are sorted unsigned, not signed.
  3580.  
  3581. SEE ALSO
  3582.       DropObject()
  3583.  
  3584.       AddTreeNode()              AddWatchedTreeNode()
  3585.       AddTreeStringNode()        AddWatchedTreeStringNode()
  3586.       FindTreeNode()             RemoveWatchedTreeNode()
  3587.       FreeTreeAllNodes()         RemoveWatchedTreeStringNode()
  3588.       RecurseTree()
  3589.       RemoveTreeStringNode()
  3590.  
  3591. NAME
  3592.       RemoveTreeStringNode -- Removes a node from a binary tree.
  3593.  
  3594. SYNOPSIS
  3595.       result = RemoveTreeStringNode( bt, object, name )
  3596.                                      a0    a1     d1
  3597.  
  3598. FUNCTION
  3599.       This function will remove an object from the binary tree,
  3600.       dropping it via DropObject(), and dropping the string
  3601.       via DropString (if the node is found!).
  3602.  
  3603.       The object pointer is required to verify that the correct node is
  3604.       being removed (in case nodes with the same key exist in the same
  3605.       tree).
  3606.  
  3607.  
  3608. INPUTS
  3609.       AVLTREE    *bt; - a pointer to the root of the binary tree.
  3610.       OBJECT  object; - the object to add into the tree.
  3611.       char     *name; - the name to insert on.
  3612.  
  3613. OUTPUTS
  3614.       BOOL result
  3615.  
  3616.       returns FALSE on failure to remove.
  3617.  
  3618.  
  3619. RESULT
  3620.       The object exists in the tree at least one fewer times than it did.
  3621.  
  3622. BUGS
  3623.       none known.
  3624.  
  3625. NOTES
  3626.       Yes, that's d1, not d0 for 'name' parameter.
  3627.  
  3628. SEE ALSO
  3629.       DropObject                 DropString
  3630.  
  3631.       AddTreeNode()              AddWatchedTreeNode()
  3632.       AddTreeStringNode()        AddWatchedTreeStringNode()
  3633.       FindTreeNode()             RemoveWatchedTreeNode()
  3634.       FreeTreeAllNodes()         RemoveWatchedTreeStringNode()
  3635.       RecurseTree()
  3636.       RemoveTreeNode()
  3637.  
  3638. NAME
  3639.       RemoveWatchedSListNode -- removes a node from a watched, prioritized
  3640.                                  singly-linked list.
  3641.  
  3642. SYNOPSIS
  3643.       result = RemoveWatchedSListNode( list, object, name )
  3644.         d0                              a0     a1     d1
  3645.  
  3646. FUNCTION
  3647.       This function removes an object from a watched, singly-linked list
  3648.       with the given name.
  3649.  
  3650.       If any parties are interested, WatcherDispatch is called with
  3651.       W_REMOVE_NODE for the flag parameter.
  3652.  
  3653.  
  3654. INPUTS
  3655.       W_SLIST              list; - a pointer to the list from which to
  3656.                                     remove the object.
  3657.       OBJECT             object; - the object to remove.
  3658.       char                *name; - the name it was added as.
  3659.  
  3660.  
  3661. OUTPUTS
  3662.       BOOL result; - result code
  3663.  
  3664.       returns FALSE if can't Remove.
  3665.  
  3666.  
  3667. RESULT
  3668.       One fewer nodes are on the list.
  3669.  
  3670. BUGS
  3671.       none known.
  3672.  
  3673. NOTES
  3674.  
  3675. SEE ALSO
  3676.       FindNodePriInSList()                AddWatchedSListNode()
  3677.       AddSListNode()
  3678.       RemoveSListNode()
  3679.  
  3680. NAME
  3681.       RemoveWatchedTreeNode -- Removes an object from the watched binary
  3682.                                tree.
  3683.  
  3684. SYNOPSIS
  3685.       result = RemoveWatchedTreeNode( bt, object, key )
  3686.         d0                            a0    a1    d0
  3687.  
  3688. FUNCTION
  3689.       This function will remove an object from the watched binary tree,
  3690.       dropping it via DropObject().
  3691.  
  3692.       The object pointer is required to verify the correct node is
  3693.       being removed (in case nodes with the same key exist in the
  3694.       same tree).
  3695.  
  3696.       If any parties are interested, WatcherDispatch is called with
  3697.       W_REMOVE_NODE
  3698.  
  3699.  
  3700. INPUTS
  3701.       W_AVLTREE             *bt; - a pointer to the root of the watched
  3702.                                     binary tree.
  3703.       OBJECT             object; - the object to add into the tree.
  3704.       ULONG                 key; - the key value to insert on.
  3705.  
  3706. OUTPUTS
  3707.       BOOL result
  3708.  
  3709.       returns FALSE on failure to Remove.
  3710.  
  3711. RESULT
  3712.       The object exists in the tree at least one fewer times than it did.
  3713.  
  3714.       Remember that the keys are sorted unsigned, not signed.
  3715.  
  3716. BUGS
  3717.       none known.
  3718.  
  3719. NOTES
  3720.  
  3721. SEE ALSO
  3722.       DropObject()
  3723.  
  3724.       AddTreeNode()              AddWatchedTreeNode()
  3725.       AddTreeStringNode()        AddWatchedTreeStringNode()
  3726.       FindTreeNode()
  3727.       FreeTreeAllNodes()         RemoveWatchedTreeStringNode()
  3728.       RecurseTree()
  3729.       RemoveTreeNode()
  3730.       RemoveTreeStringNode()
  3731.  
  3732. NAME
  3733.       RemoveWatchedTreeStringNode -- Removes an object from the given
  3734.                                      binary tree
  3735.  
  3736. SYNOPSIS
  3737.       result = RemoveWatchedTreeStringNode( bt, object, name )
  3738.         d0                                 a0    a1     d1
  3739.  
  3740. FUNCTION
  3741.       This function will remove an object from the watched binary tree,
  3742.       dropping it via DropObject(), and dropping the string
  3743.       via DropString (if node is found!).
  3744.  
  3745.       The object pointer is required to verify the correct node is
  3746.       being removed (in case nodes with the same key exist in the
  3747.       same tree).
  3748.  
  3749.       If any parties are interested, WatcherDispatch is called with
  3750.       W_REMOVE_NODE
  3751.  
  3752.  
  3753. INPUTS
  3754.       W_AVLTREE      *bt; - a pointer to the root of the watched binary
  3755.                              tree.
  3756.       OBJECT      object; - the object to add into the tree.
  3757.       char         *name; - the name to insert on.
  3758.  
  3759. OUTPUTS
  3760.       BOOL result
  3761.  
  3762.       returns FALSE on failure to remove.
  3763.  
  3764.  
  3765. RESULT
  3766.       The object exists in the tree at least one fewer times than it did.
  3767.  
  3768. BUGS
  3769.       none known.
  3770.  
  3771. NOTES
  3772.  
  3773. SEE ALSO
  3774.       DropObject                 DropString
  3775.  
  3776.       AddTreeNode()              AddWatchedTreeNode()
  3777.       AddTreeStringNode()        AddWatchedTreeStringNode()
  3778.       FindTreeNode()             RemoveWatchedTreeNode()
  3779.       FreeTreeAllNodes()
  3780.       RecurseTree()
  3781.       RemoveTreeNode()
  3782.       RemoveTreeStringNode()
  3783.  
  3784. NAME
  3785.       RemoveWatcherNode -- Removes a watcher to the watched variable
  3786.  
  3787. SYNOPSIS
  3788.       result = RemoveWatcherNode( wv, node, name )
  3789.                                   a0   a1    d1
  3790.  
  3791. FUNCTION
  3792.       This removes a watcher node from a watched variable.  This
  3793.       is a low-level routine.  You should call the DIRECTOR CLASS
  3794.       routines instead.  See browser.c, or ShadowLibMethods.doc.
  3795.  
  3796.       If any parties are interested, WatcherDispatch is called with
  3797.       W_REMOVE_WATCHER for the flag parameter.
  3798.  
  3799.  
  3800. INPUTS
  3801.       W_VALUE             *wv; - the watched variable being watched.
  3802.       OBJECT             node; - the director to remove from the watch
  3803.                                   list.
  3804.       char              *name; - the name of the watcher.
  3805.  
  3806. OUTPUTS
  3807.       BOOL result
  3808.  
  3809.       returns FALSE if failed to Remove.
  3810.  
  3811.  
  3812. RESULT
  3813.       The director is removed from the watch list.
  3814. BUGS
  3815.       none known.
  3816.  
  3817. NOTES
  3818.  
  3819. SEE ALSO
  3820.       AddWatcherNode()
  3821.       AddClassWatcher()
  3822.       RemoveClassWatcher()
  3823.  
  3824. NAME
  3825.       ReplaceObject -- Semaphored access to an object in a public area.
  3826.  
  3827. SYNOPSIS
  3828.       oldObject = ReplaceObject(objectPtr ,newObject, oldValue )
  3829.          d0                        a1          d0        d1
  3830.  
  3831. FUNCTION
  3832.       In some attributes, there may be object pointers that you need
  3833.       to change in that attribute.  On the other hand, somebody else
  3834.       might retrieve it at the same time.
  3835.  
  3836.       This function uses the ShadowBase->sb_semSemaphore to protect the
  3837.       access to the objectPtr.  The object that is returned is returned
  3838.       Use()'d, so when you are done with the object you should call
  3839.       DropObject(object) on it.  The old value that was stored at the
  3840.       objectPtr address is returned as oldObject and replaced by
  3841.       newObject if, and only if, it is the same as oldValue.  Otherwise
  3842.       newObject is returned.
  3843.  
  3844.       The newObject is TRANSFERRED to the address, so if you want to
  3845.       maintain a valid pointer in newObject when ReplaceObject() returns,
  3846.       call this function like this:
  3847.  
  3848.          oldObject = ReplaceObject(objectPtr, UseObject(newObject), old);
  3849.  
  3850.       If you don't care about the returned object, you should call the
  3851.       function like this:
  3852.          DropObject(ReplaceObject(objectPtr, newObject, old));
  3853.  
  3854.       Note: the returned object may, in fact, be newObject, or oldValue --
  3855.       be sure you know what you're doing!
  3856.  
  3857. INPUTS
  3858.       OBJECT  *objectPtr; - the pointer to the structure element that
  3859.                              holds the object pointer you want.
  3860.       OBJECT   newObject; - object to transfer into the objectPtr.
  3861.       OBJECT   oldValue;  - the object value that this function will
  3862.                              check for before replacing with newObject.
  3863.  
  3864. OUTPUTS
  3865.       void       *object; - either the same as oldValue or, newObject if
  3866.                              *objectPtr doesn't point to oldValue.
  3867.  
  3868. RESULT
  3869.  
  3870. BUGS
  3871.       none known.
  3872.  
  3873. NOTES
  3874.  
  3875. SEE ALSO
  3876.       GetObject()
  3877.       SetObject()
  3878.  
  3879. NAME
  3880.       SetMethodArgs -- parses a ArgumentTag structure for method creation.
  3881.  
  3882. SYNOPSIS
  3883.       SetMethodArgs( mh, args )
  3884.                      a0   a1
  3885.  
  3886. FUNCTION
  3887.       This is a system function, you should not need to call it.
  3888.       However, it does serve to elucidate several issues wrt ARGUMENT_TAG
  3889.       structures.
  3890.  
  3891.       This function parses out the ArgumentTag structure.
  3892.       It sets up the mh_num, mh_size and mh_args field in the
  3893.       passed MethodHandle structure.
  3894.  
  3895.       If the function returns a variable that needs to be kept
  3896.       track of, the last ArgumentTag structure (whose at_tag should be
  3897.       zero) in the array should contain information for async. method
  3898.       sends to safely deallocate or otherwise resource track the
  3899.       returned value.
  3900.  
  3901.       Valid returns are:
  3902.        SHADOW_RETURN_BLANK   0
  3903.        SHADOW_RETURN_OBJECT  1
  3904.        SHADOW_RETURN_STRING  2
  3905.        SHADOW_RETURN_PORT    3
  3906.        SHADOW_RETURN_TAGL    4
  3907.        SHADOW_RETURN_PTR     5
  3908.        SHADOW_RETURN_MRFO    6
  3909.  
  3910.       These values should be stored in the at_size field of the last
  3911.       ArgumentTag array item..
  3912.  
  3913.       For SHADOW_RETURN_PTR, the size of the pointer should be stored
  3914.       in the at_flags field of the same item, for SHADOW_RETURN_TAGL,
  3915.       the size of each array item should be stored in the at_flags field
  3916.       of this last item, and for SHADOW_RETURN_MRFO, the offset of the
  3917.       returned data from the object in question should be placed in the
  3918.       at_flags field
  3919.  
  3920.       Normally, the system supports a number of at_tag values:
  3921.          'MRFO':
  3922.             used for object values which add at_flags to
  3923.                   the passed object pointer.
  3924.             at_size should be four
  3925.             at_flags -- the offset of the passed data from the object ptr.
  3926.  
  3927.             Note that MRFO exists for system use, however you are free to
  3928.             use the item as well -- but it's of little to no use, just
  3929.             pass the object instead!
  3930.  
  3931.          'JOBJ':
  3932.             Used for an object.
  3933.             at_size should be four
  3934.             at_flags should be one of:
  3935.                SHADOW_OBJECT
  3936.                SHADOW_CLASSLESSOBJECT
  3937.                SHADOW_META
  3938.                SHADOW_CLASS,
  3939.                SHADOW_CLUSTER
  3940.                SHADOW_COMPOSITE
  3941.              though this is more for peace of mind than necessity.
  3942.  
  3943.          'JMSG':
  3944.             Used for a message creted by MessageMaker()
  3945.             at_size should be four
  3946.             at_flags should be zero
  3947.  
  3948.          'JSTR':
  3949.             Used for a system string.
  3950.             at_size should be four
  3951.             at_flags should be zero
  3952.  
  3953.          'PORT':
  3954.             Used for a ppipc port.
  3955.             at_size should be four
  3956.             at_flags should be ???? <-- anything you like!
  3957.  
  3958.          'TAGL':
  3959.             Used for a NULL terminated array.
  3960.             at_size should be four.
  3961.             at_flags should be the size of each array item
  3962.  
  3963.          'RTRN':
  3964.             reserved by the system, don't use.
  3965.          'APTR'
  3966.             a pointer to some memory.
  3967.             at_size should be four.
  3968.             at_flags should be zero if you don't want to copy the data to
  3969.              another block when sending async., or should be the size of
  3970.              the data pointed to if you do.
  3971.  
  3972.          Create you own 4 character constant:
  3973.             at_size should be an even number -- you can pass arbitrarily
  3974.              large structures on the stack, this way.
  3975.             at_flags ignored.
  3976.  
  3977.  
  3978. INPUTS
  3979.       struct MethodHandle *mh; - a MethodHandle being initialized.
  3980.       ARGUMENT_TAG     args[]; - the (optional, and NULL-terminated)
  3981.                                   ArgumentTag array for this handle.
  3982.  
  3983. OUTPUTS
  3984.  
  3985.  
  3986. RESULT
  3987.       mh->mh_args, mh->mh_num, mh->mh_size fields are set up properly.
  3988.  
  3989. BUGS
  3990.       none known.
  3991.  
  3992. NOTES
  3993.  
  3994. SEE ALSO
  3995.       DSM()                            DoShadow()
  3996.       InvalidateCache()
  3997.       AddMethods()
  3998.       DestroyMethodTable()
  3999.       FindMethodHandle()
  4000.       BlockMethod()
  4001.       RemoveAllPatches()
  4002.       SetupMethodTags()
  4003.  
  4004. NAME
  4005.       SetObject -- Semaphored access to an object in a public area.
  4006.  
  4007. SYNOPSIS
  4008.       oldObject = SetObject(objectPtr , newObject )
  4009.          d0                    a1          d1
  4010.  
  4011. FUNCTION
  4012.       In some attributes, there may be object pointers that you need
  4013.       to change in that attribute.  On the other hand, somebody else
  4014.       might retrieve it at the same time.
  4015.  
  4016.       This function uses the ShadowBase->sb_semSemaphore to protect the
  4017.       access to the objectPtr.  The object that is returned is returned
  4018.       Use()'d, so when you are done with the object you should call
  4019.       DropObject(object) on it.  The old value that was stored at the
  4020.       objectPtr address is returned as oldObject and replaced by
  4021.       newObject.
  4022.  
  4023.       The newObject is TRANSFERRED to the address, so if you want to
  4024.       maintain a valid pointer in newObject when SetObject() returns,
  4025.       call this function like this:
  4026.  
  4027.          oldObject = SetObject(objectPtr, UseObject(newObject));
  4028.  
  4029.       If you don't care about the returned object, you should call the
  4030.       function like this:
  4031.          DropObject(SetObject(objectPtr, newObject));
  4032.  
  4033.  
  4034. INPUTS
  4035.       OBJECT  *objectPtr; - the pointer to the structure element that
  4036.                              holds the object pointer you want.
  4037.       OBJECT   newObject; - object to transfer into the objectPtr.
  4038.  
  4039. OUTPUTS
  4040.       void       *object; - the object that *objectPtr points to.
  4041.  
  4042. RESULT
  4043.  
  4044. BUGS
  4045.       none known.
  4046.  
  4047. NOTES
  4048.  
  4049. SEE ALSO
  4050.       GetObject()
  4051.       ReplaceObject();
  4052.  
  4053. NAME
  4054.       SetShadowError -- Sets an error code for SHADOW
  4055.  
  4056. SYNOPSIS
  4057.       SetShadowError(error, sub_error)
  4058.                        d0            d1
  4059.  
  4060. FUNCTION
  4061.       This function sets the last SHADOW error and suberror that
  4062.       occurred within the calling process' context to the passed values.
  4063.  
  4064.  
  4065. INPUTS
  4066.       error                      ; - the error code to set.
  4067.       sub_error                  ; - the sub-error code to set.
  4068.  
  4069. OUTPUTS
  4070.       <none>
  4071.  
  4072.  
  4073. RESULT
  4074.  
  4075. BUGS
  4076.       none known.
  4077.  
  4078. NOTES
  4079.  
  4080. SEE ALSO
  4081.       GetShadowError
  4082.  
  4083. NAME
  4084.       SetupMethodTags -- defines all methods in the MethodTag array as
  4085.                            being run by a certain process object, and
  4086.                            being owned by a certain object.
  4087.  
  4088. SYNOPSIS
  4089.       SetupMethodTags( tags, procObject, defnObject )
  4090.                         a1       d0          d1
  4091.  
  4092. FUNCTION
  4093.       This function will initialize the (required, NULL-terminated) tags
  4094.       array so that each method is located in a particular defnObject and
  4095.       wants to be called in a partiular procObject's process.
  4096.  
  4097.       For instance, gui methods may exist in a libraryObject (ie: a
  4098.       library) and want to be run by the guiProcObject.
  4099.  
  4100.       If passed objects of -1, the current task object is used.
  4101.          [That is; FindTask(NULL)->tc_UserData -- CurrentProcess()]
  4102.  
  4103.       If any element within the METHOD_TAG has a defnObject already set
  4104.       (non-NULL), then the defnObject for that element remains as before.
  4105.       Similarly for the procObject field.
  4106.  
  4107.  
  4108. INPUTS
  4109.       METHOD_TAG             tags[]; - NULL-terminated MethodTag array.
  4110.       OBJECT             procObject; - the process object in which to run
  4111.                                         the methods.
  4112.       OBJECT             defnObject; - the object that "contains" the
  4113.                                         definition of the ArgumentTag -and-
  4114.                                         the function code.
  4115.  
  4116. OUTPUTS
  4117.  
  4118.  
  4119. RESULT
  4120.  
  4121. BUGS
  4122.       none known.
  4123.  
  4124. NOTES
  4125.       This is what guarantees that the function and ArgumentTag pointers
  4126.       remain valid as long as a method could call that function.
  4127.       The ArgumentTag structure is NOT copied when stored into the
  4128.       MethodHandler structure (the information in MethodTags and
  4129.       AttributeTags is).
  4130.  
  4131.       This function does not produce valid results for methods that are
  4132.       defined as METH_FLAG_CLASS or METH_FLAG_PORT or METH_FLAG_SPEC.
  4133.       You will have to fill in the procObject field for these
  4134.       method-types yourself.
  4135.  
  4136.       SetupMethodTags() only affects procObject and defnObject fields
  4137.       that are NULL.
  4138.  
  4139. SEE ALSO
  4140.       DSM()                            DoShadow()
  4141.       InvalidateCache()
  4142.       SetMethodArgs()
  4143.       AddMethods()
  4144.       DestroyMethodTable()
  4145.       FindMethodHandle()
  4146.       BlockMethod()
  4147.       RemoveAllPatches()
  4148.  
  4149. NAME
  4150.       UseObject -- resource tracking for shadow objects.
  4151.  
  4152. SYNOPSIS
  4153.       object = UseObject( object )
  4154.         d0                  a0
  4155.  
  4156. FUNCTION
  4157.       This function increments the object's cob_useCount field.
  4158.       You should Use an object whenever you save a pointer into
  4159.       a structure.
  4160.  
  4161.  
  4162. INPUTS
  4163.       OBJECT      object; - the object to effect the change upon.
  4164.                              If NULL, nothing happens
  4165.  
  4166. OUTPUTS
  4167.       OBJECT      object; - the same as the object sent in.
  4168.  
  4169.  
  4170. RESULT
  4171.       object's cob_object is incremented.
  4172.  
  4173. BUGS
  4174.       none known.
  4175.  
  4176. NOTES
  4177.  
  4178. SEE ALSO
  4179.       DropObject()
  4180.  
  4181. NAME
  4182.       UseString -- gets a system-wide address for a given string.
  4183.  
  4184. SYNOPSIS
  4185.       string = UseString( buffer )
  4186.         d0                  a2
  4187.  
  4188. FUNCTION
  4189.       Shadow uses a system very much similar to the NeXT's -- a system-
  4190.       wide repository for statis-string addresses.
  4191.  
  4192.       Strings are hashed into a 1024 table entry and chained onto sorted
  4193.       binary trees.  The string which is returned is guaranteed to be a
  4194.       unique string address for the passed buffer.
  4195.  
  4196.       The passed buffer's address is *NOT* used as the system string
  4197.       address, so it can be a temporary stack-allocated buffer.  The
  4198.       system string is created when a first UseString() is called for
  4199.       a given buffer.  On the second UseString() call for the same buffer,
  4200.       the same string address will be returned, and an internal counter
  4201.       which tracks the string usage is incremented.
  4202.  
  4203.       These system strings may *NOT* be mangled, they are read-only.
  4204.       They are particularly good for static data that you wish to do
  4205.       searches on, as system-strings have a unique address, strcmp() is
  4206.       unnecessary, merely compare the string addresses.  They are used
  4207.       internally for BinNode strings, method names, attribute names,
  4208.       class names, etc.
  4209.  
  4210.  
  4211. INPUTS
  4212.       char *buffer; - the string to retrieve a unique system pointer for.
  4213.                       Given a NULL input, will return NULL.
  4214.  
  4215. OUTPUTS
  4216.       char *string; - the unique string as returned by the system.  A NULL
  4217.                       signals an error.
  4218.  
  4219.  
  4220. RESULT
  4221.       Either a new system string is created, and the buffer copied into
  4222.       it, or an old system string is retrieved and its usage counter
  4223.       incremented.
  4224.  
  4225. BUGS
  4226.       none known.
  4227.  
  4228. NOTES
  4229.       The buffer should be word-aligned for faster access and long-word
  4230.       aligned for fastest access.
  4231.  
  4232. SEE ALSO
  4233.       QuickUseString()
  4234.       FindString()
  4235.       DropString()
  4236.       QuickDropString()
  4237.  
  4238. NAME
  4239.       VSem -- Vacate a semaphore
  4240.  
  4241. SYNOPSIS
  4242.       VSem( address )
  4243.               a0
  4244.  
  4245. FUNCTION
  4246.       This function does the equivalent of a ReleaseSemaphore on the
  4247.       given address.
  4248.  
  4249.       Every PSem() should be matched with a VSem(), except for PSem()s
  4250.       where an SSEM_ATTEMPT failed (returned NULL, in which case VSem()
  4251.       should NOT be called.
  4252.  
  4253.  
  4254. INPUTS
  4255.       void *address; - Any address in the system.
  4256.  
  4257. OUTPUTS
  4258.  
  4259.  
  4260. RESULT
  4261.       The semaphore will be released (vacated), and the semaphore object
  4262.       freed if no longer needed.
  4263.  
  4264. BUGS
  4265.       none known.
  4266.  
  4267. NOTES
  4268.       If no semaphore with that address can be found, nothing happens.
  4269.       But this case may a bug in the user program as you shoudn't
  4270.       be freeing semaphores no one has allocated....
  4271.  
  4272. SEE ALSO
  4273.       From exec.library:
  4274.          ReleaseSemaphore()
  4275.  
  4276.       PSem()
  4277.       Introduction.doc
  4278.  
  4279. NAME
  4280.       VSemString -- used to ensure single-threaded startup.
  4281.  
  4282. SYNOPSIS
  4283.       VSemString( char  *string )
  4284.                         a0
  4285.  
  4286. FUNCTION
  4287.       Does the following:
  4288.          VSem(FindString(string), semFlags);
  4289.          DropString(string);
  4290.  
  4291.       The browser uses this function to ensure that only a single
  4292.       copy of itself is running.
  4293.  
  4294.  
  4295. INPUTS
  4296.       char     *string; - the system string equivalent which is used to
  4297.                            semaphore thread startup.
  4298.  
  4299. OUTPUTS
  4300.       none.
  4301.  
  4302. RESULT
  4303.  
  4304. BUGS
  4305.       none known.
  4306.  
  4307. NOTES
  4308.  
  4309. SEE ALSO
  4310.       PSemString()
  4311.       PSem()
  4312.       VSem()
  4313.  
  4314. NAME
  4315.       WaitThread -- synchronizes thread startup.
  4316.  
  4317. SYNOPSIS
  4318.       task = WaitThread( )
  4319.        d0
  4320.  
  4321. FUNCTION
  4322.       This function is no longer valid under SHADOW V.  If you have been
  4323.       calling it and need directions on how to update your software,
  4324.       please see both the ShadowLibraryMethods.doc and the
  4325.       Introduction.doc about the PROCESS_CLASS.
  4326.  
  4327. NAME
  4328.       WatcherDispatch -- Dispatches all notification methods.
  4329.  
  4330. SYNOPSIS
  4331.       WatcherDispatch( flag, wv, first, second )
  4332.                         d0   a0    a1     d1
  4333.  
  4334. FUNCTION
  4335.       This function dispatches notification to all parties that
  4336.       have added themselves either to the WatchedVariable in
  4337.       question, or to the SList that wv->wv_firstClass points to.
  4338.  
  4339.       Watched Values are a tricky subject which will require a lot
  4340.       more than a simple AutoDoc note to explain them.
  4341.  
  4342.       Please see examples in browser.c for now, or refer to the
  4343.       DIRECTOR_CLASS documentation in ShadowLibMethods.doc and
  4344.       Introduction.doc.
  4345.  
  4346.  
  4347. INPUTS
  4348.       long    flag; - Informs of the type of change made to the value:
  4349.                         W_CHANGE_ZERO      1
  4350.                         W_CHANGE_NON_ZERO  2
  4351.                         W_INSERT_WATCHER  40
  4352.                         W_REMOVE_WATCHER  24
  4353.                         W_INSERT_NODE     32
  4354.                         W_REMOVE_NODE     16
  4355.       W_VALUE  *wv; - the watchedValue that was changed.
  4356.       void  *first; - the object that was added to the list/AVLTREE, or
  4357.                        the value that the variable was changed to.
  4358.       void *second; - the name or key for the new node in the list/AVLTREE
  4359.  
  4360. OUTPUTS
  4361.  
  4362.  
  4363. RESULT
  4364.       All interested parties are informed of the change.
  4365.  
  4366. BUGS
  4367.       none known.
  4368.  
  4369. NOTES
  4370.  
  4371. SEE ALSO
  4372.       AddWatcherNode()
  4373.       AddClassWatcher()
  4374.